chore: initial import for test contour
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { API, authHeader } from './apiSlice'
|
||||
/*
|
||||
const authHeader = () => {
|
||||
const token = localStorage.getItem('token')
|
||||
return token ? { Authorization: `Bearer ${token}` } : {}
|
||||
}
|
||||
*/
|
||||
export const departmentApi = API.injectEndpoints({
|
||||
endpoints: (build) => ({
|
||||
getDepartments: build.query({
|
||||
query: () => '/department/list',
|
||||
}),
|
||||
updateDepartments: build.mutation({
|
||||
query: ({ departmentId, data }) => {
|
||||
return ({
|
||||
url: `/department/${departmentId}`,
|
||||
method: 'PUT',
|
||||
headers: authHeader(),
|
||||
body: JSON.stringify(data),
|
||||
})},
|
||||
}),
|
||||
createDepartments: build.mutation({
|
||||
query: ({ data }) => {
|
||||
return ({
|
||||
url: `/department/create`,
|
||||
method: 'POST',
|
||||
headers: authHeader(),
|
||||
body: JSON.stringify(data),
|
||||
})},
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
export const {
|
||||
useGetDepartmentsQuery,
|
||||
useUpdateDepartmentsMutation,
|
||||
useCreateDepartmentsMutation,
|
||||
} = departmentApi
|
||||
Reference in New Issue
Block a user