|
@@ -30,7 +30,7 @@ export const categoryApi = createApi({
|
|
|
}
|
|
|
}
|
|
|
`}),
|
|
|
- providesTags: (result, error, arg) => {
|
|
|
+ providesTags: (result) => {
|
|
|
return result
|
|
|
? [...result.CategoryFind.map(obj => ({ type: 'Category', _id: obj._id })), 'Category']
|
|
|
: ['Category'];
|
|
@@ -52,7 +52,7 @@ export const categoryApi = createApi({
|
|
|
variables: params
|
|
|
}
|
|
|
},
|
|
|
- providesTags: (result, error, arg) => {
|
|
|
+ providesTags: (result) => {
|
|
|
return result
|
|
|
? [...result.CategoryFind.map(obj => ({ type: 'Category', _id: obj._id })), 'Category']
|
|
|
: ['Category'];
|
|
@@ -70,9 +70,6 @@ export const categoryApi = createApi({
|
|
|
},
|
|
|
providesTags: ['CategoryCount'],
|
|
|
}),
|
|
|
- /*forceRefetch(arg) {
|
|
|
- return JSON.stringify(arg.currentArg) !== JSON.stringify(arg.previousArg);
|
|
|
- },*/
|
|
|
getCategoryById: builder.query({
|
|
|
query: (_id) => ({
|
|
|
document: gql`
|
|
@@ -89,7 +86,7 @@ export const categoryApi = createApi({
|
|
|
`,
|
|
|
variables: { q: JSON.stringify([{ _id }]) }
|
|
|
}),
|
|
|
- providesTags: (result, error, arg) => {
|
|
|
+ providesTags: (result) => {
|
|
|
return result
|
|
|
? [{ type: 'Category', _id: result.CategoryFindOne._id }, 'Category']
|
|
|
: ['Category'];
|
|
@@ -110,10 +107,10 @@ export const categoryApi = createApi({
|
|
|
variables: { category: { ...category } }
|
|
|
}
|
|
|
),
|
|
|
- transformResponse: (response, meta, arg) => {
|
|
|
+ transformResponse: (response) => {
|
|
|
return response;
|
|
|
},
|
|
|
- transformErrorResponse: (response, meta, arg) => {
|
|
|
+ transformErrorResponse: (response) => {
|
|
|
return response;
|
|
|
},
|
|
|
invalidatesTags: (result, error, arg) => {
|
|
@@ -126,14 +123,5 @@ export const categoryApi = createApi({
|
|
|
}),
|
|
|
})
|
|
|
|
|
|
-/*export const categoryApi = categoryApiInt.enhanceEndpoints({
|
|
|
- endpoints: {
|
|
|
- getCategoriesCount(endpoint) {
|
|
|
- endpoint.refetchOnMountOrArgChange = true;
|
|
|
- }
|
|
|
- }
|
|
|
-})*/
|
|
|
-
|
|
|
-
|
|
|
export const { useGetRootCategoriesQuery, useGetCategoryByIdQuery, useGetCategoriesQuery, useGetCategoriesCountQuery, useSaveCategoryMutation } = categoryApi;
|
|
|
|