UNPKG

@atomazing-org/mock-plop

Version:

The `@atomazing-org/mock-plop` library is a configuration script designed for Plop, a tool aimed at automating code generation within projects utilizing templates. Specifically, this script focuses on generating and updating files associated with mocks (p

29 lines (25 loc) 726 B
import { baseApi } from '@api/baseApi' import type { {{ properCase name }} } from '@models/{{ properCase name }}' export const {{ camelCase name }}Api = baseApi .enhanceEndpoints({addTagTypes: [{{ properCase name }}]}) .injectEndpoints({ endpoints: builder => ({ get{{ properCase name }}: builder.query<{{ properCase name }}[], void>({ query: () => ({ url: `{{ url }}`, method: 'GET', }), }), post{{ properCase name }}: builder.mutation({ query: () => ({ url: '{{ url }}', method: 'POST', responseHandler: 'text', }), }), }), }) export const { useGet{{ properCase name }}Query, usePost{{ properCase name }}Mutation } = {{ camelCase name }}Api