← All changes
|
backend/views/components/Main/features/search/searchApi.js
+8
-3
1.3.54
→
1.4.21
View file →
| @@ -1,16 +1,21 @@ | ||
| 1 | +import { buildQueryUrl } from '../../utilities/utilities'; | |
| 1 | 2 | import { apiSlice } from '../api/apiSlice'; |
| 2 | 3 | |
| 3 | 4 | export const searchApi = apiSlice.injectEndpoints({ |
| 4 | 5 | endpoints: (builder) => ({ |
| 5 | 6 | getProducts: builder.query({ |
| 6 | - query: (query) => `search/product?search=${query}`, | |
| 7 | + query: (query) => | |
| 8 | + buildQueryUrl('search/product', `search=${query}`), | |
| 7 | 9 | }), |
| 8 | 10 | getTags: builder.query({ |
| 9 | - query: (query) => `search/tag?search=${query}`, | |
| 11 | + query: (query) => buildQueryUrl('search/tag', `search=${query}`), | |
| 10 | 12 | }), |
| 11 | 13 | getSearchItem: builder.query({ |
| 12 | - query: ({ endpoint, searchQuery }) => `${endpoint}${searchQuery}`, | |
| 14 | + query: ({ endpoint, searchQuery }) => { | |
| 15 | + const [path, query = ''] = endpoint.split('?'); | |
| 16 | + return buildQueryUrl(path, `${query}${searchQuery}`); | |
| 17 | + }, | |
| 13 | 18 | }), |
| 14 | 19 | }), |
| 15 | 20 | }); |
| 16 | 21 | |