admin pages Working👷♂️
This commit is contained in:
47
src/Services/ban.investor.service.js
Normal file
47
src/Services/ban.investor.service.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// investorDetails.service.js
|
||||
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
||||
// import { api } from "./api.service";
|
||||
import { baseQuery } from "./token.serivce";
|
||||
|
||||
// const baseUrl = api?.defaults.baseURL;
|
||||
|
||||
// Define a service using a base URL and expected endpoints
|
||||
export const banInvestorDetails = createApi({
|
||||
reducerPath: "banInvestorDetails",
|
||||
baseQuery: baseQuery,
|
||||
tagTypes: ["getBanInvestor", "getUnbanInvestor"],
|
||||
endpoints: (builder) => ({
|
||||
getInvestor: builder.query({
|
||||
query: () => `/investorDetails/admin`,
|
||||
providesTags: ["getBanInvestor"],
|
||||
}),
|
||||
|
||||
getUnbanInvestor: builder.query({
|
||||
query: () => `/investorDetails/admin/getAllUnbanned`,
|
||||
providesTags: ["getBanInvestor"],
|
||||
}),
|
||||
|
||||
getbanInvestor: builder.query({
|
||||
query: () => `/investorDetails/admin/getAllBanned`,
|
||||
providesTags: ["getBanInvestor"],
|
||||
}),
|
||||
|
||||
updateUnban: builder.mutation({
|
||||
query: ({ id, data }) => ({
|
||||
url: `/investorDetails/admin/unBanById/${id}`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getBanInvestor"],
|
||||
}),
|
||||
|
||||
}),
|
||||
});
|
||||
|
||||
// Export hooks for usage in functional components
|
||||
export const {
|
||||
useGetUnbanInvestorQuery,
|
||||
useGetInvestorQuery,
|
||||
useGetbanInvestorQuery,
|
||||
useUpdateUnbanMutation,
|
||||
} = banInvestorDetails;
|
||||
Reference in New Issue
Block a user