2025-03-06 13:16:38 +05:30
|
|
|
import { createApi } from "@reduxjs/toolkit/query/react";
|
2025-02-10 19:34:29 +05:30
|
|
|
import { baseQueryWithReauth } from "./apiSlice";
|
|
|
|
|
|
2025-03-06 13:16:38 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
export type SubAdminPost = {
|
|
|
|
|
id: number;
|
|
|
|
|
first_name: string,
|
|
|
|
|
last_name: string,
|
|
|
|
|
unique_id:string,
|
|
|
|
|
date_of_birth:string,
|
|
|
|
|
gender: string,
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-10 19:34:29 +05:30
|
|
|
export const manageSubAdmin = createApi({
|
2025-02-10 19:54:18 +05:30
|
|
|
reducerPath: "manageSubAdmin",
|
2025-02-10 19:34:29 +05:30
|
|
|
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
2025-03-06 13:16:38 +05:30
|
|
|
tagTypes: ['SubAdmin'],
|
|
|
|
|
endpoints: (builder) => ({
|
|
|
|
|
getSubAdmin: builder.query<SubAdminPost[], void>({
|
|
|
|
|
query: () => `/sub-admin-view/2` }),
|
2025-02-10 19:34:29 +05:30
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
2025-03-06 13:16:38 +05:30
|
|
|
export const {
|
|
|
|
|
useGetSubAdminQuery,
|
|
|
|
|
} = manageSubAdmin;
|
2025-02-10 19:34:29 +05:30
|
|
|
|
|
|
|
|
export type Post = {
|
|
|
|
|
id: number;
|
|
|
|
|
title: string;
|
|
|
|
|
body: string;
|
|
|
|
|
};
|