MSP-3174 add securityLogServiceApi
This commit is contained in:
1 parent
99ee80a579
commit
97d878fafb
1 file changed
+31
@@ -0,0 +1,31 @@
|
||||
import { createApi } from '@reduxjs/toolkit/query/react'
|
||||
|
||||
import { apiPaths } from '@constants/api/apiPaths'
|
||||
|
||||
import { axiosBaseQuery } from '@utils/apiUtils'
|
||||
|
||||
import { LimitOffsetRequestType } from '@type/index.ts'
|
||||
import { LogEventType, LogResponseType, SetEventType } from '@type/log.type'
|
||||
|
||||
const securityLogServiceApi = createApi({
|
||||
reducerPath: 'securityLogService',
|
||||
refetchOnFocus: true,
|
||||
tagTypes: ['logs', 'events'],
|
||||
baseQuery: axiosBaseQuery({ baseUrl: apiPaths.baseAdminUrl }),
|
||||
endpoints: (builder) => ({
|
||||
getAllLogs: builder.mutation<LogResponseType, LimitOffsetRequestType>({
|
||||
query: (request) => ({ url: apiPaths.getAllLogs, data: request }),
|
||||
invalidatesTags: () => ['logs']
|
||||
}),
|
||||
getLogEvents: builder.query<LogEventType[], void>({
|
||||
query: () => ({ url: apiPaths.getLogEvents }),
|
||||
providesTags: () => ['events']
|
||||
}),
|
||||
setLogEvents: builder.mutation<void, SetEventType[]>({
|
||||
query: (request) => ({ url: apiPaths.setLogEvents, data: request }),
|
||||
invalidatesTags: () => ['events']
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export default securityLogServiceApi
|
||||
Reference in new issue
Block a user