MSP-3106 add tokensApi
This commit is contained in:
1 parent
d2605f661b
commit
114c3964d0
1 file changed
+30
@@ -0,0 +1,30 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
import { apiPaths } from '@constants/api/apiPaths.ts'
|
||||
|
||||
import {
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType,
|
||||
} from '@pages/ApplicationsPage/applications.type.ts'
|
||||
|
||||
import { axiosBaseQuery } from '@utils/apiUtils.ts'
|
||||
|
||||
const tokensApi = createApi({
|
||||
reducerPath: 'tokensApi',
|
||||
refetchOnFocus: true,
|
||||
tagTypes: ['Tokens'],
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseSystemUrl }),
|
||||
endpoints: (builder) => ({
|
||||
createToken: builder.mutation<
|
||||
ApplicationTokenType,
|
||||
NewApplicationTokenType
|
||||
>({
|
||||
query: ( NewApplicationTokenType) => ({
|
||||
url: apiPaths.createToken,
|
||||
data: NewApplicationTokenType
|
||||
}),
|
||||
invalidatesTags: ['Tokens']
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
export default tokensApi
|
||||
Reference in new issue
Block a user