Commit ee82867b authored by Merekeyev Dias's avatar Merekeyev Dias

added request endpoints

parent 9ebbeef6
......@@ -19,6 +19,6 @@ export const apiSlice = createApi({
return headers;
},
}),
tagTypes: ["organizations"],
tagTypes: ["organizations", "requests"],
endpoints: () => ({}),
});
\ No newline at end of file
import { apiSlice } from "./apiSlice";
interface Request {
id: number;
sendDate: string;
errorMessage: string;
resendDate: null;
resentCount: number;
status: number;
esutdOrganizationCode: string;
requestType: string;
documentID: string;
xml: string;
}
export const requestApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
getRequests: builder.query<Request[], void>({
query: () => 'requests/list',
providesTags: ["requests"],
}),
addNewRequest: builder.mutation<Request, Partial<Request>>({
query: (initialReq) => ({
url: 'requests/save',
method: 'POST',
body: initialReq,
}),
invalidatesTags: ["requests"],
})
})
})
export const {
useAddNewRequestMutation,
useGetRequestsQuery,
} = requestApiSlice;
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment