chore: initial import for test contour

This commit is contained in:
sova-bootstrap
2026-05-27 19:36:33 +03:00
commit ffd4cf9031
105 changed files with 10772 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
import { API } from './apiSlice'
const authHeader = () => {
const token = localStorage.getItem('token')
return token ? { Authorization: `Bearer ${token}` } : {}
}
export const locationApi = API.injectEndpoints({
endpoints: (build) => ({
createLocation: build.mutation({
query: ({ specialistId, data }) => ({
url: `/specialist/${specialistId}/location/create`,
method: 'POST',
headers: authHeader(),
body: JSON.stringify(data),
}),
invalidatesTags: ['Specialist'],
}),
updateLocation: build.mutation({
query: ({ specialistId, locationId, data }) => {
return ({
url: `/specialist/${specialistId}/location/${locationId}`,
method: 'PUT',
headers: authHeader(),
body: JSON.stringify(data),
})},
}),
deleteLocation: build.mutation({
query: (locationId) => ({
url: `/location/${locationId}`,
method: 'DELETE',
headers: authHeader(),
}),
}),
getEmptyLocations: build.query({
query: () => {
return {
url: `/locations/empty`,
headers: authHeader(),
};
},
}),
}),
})
export const {
useCreateLocationMutation,
useUpdateLocationMutation,
useDeleteLocationMutation,
useGetEmptyLocationsQuery,
} = locationApi