admin pages Working👷‍♂️

This commit is contained in:
YasinShaikh123
2024-09-17 15:33:27 +05:30
parent ab175b4c76
commit a126d6515d
16 changed files with 968 additions and 194 deletions

View 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;