gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/admins/contexts/router.ts · v0.4.0
Source
1 4708fcb Dawsh 2y ago import { createContext, useContext } from "react";
2 4708fcb Dawsh 2y ago import { AdminType } from "@marzneshin/features/admins";
3 4708fcb Dawsh 2y ago
4 4708fcb Dawsh 2y ago interface RouterAdminContextProps {
5 4708fcb Dawsh 2y ago admin: AdminType | null;
6 4708fcb Dawsh 2y ago isPending?: boolean;
7 4708fcb Dawsh 2y ago }
8 4708fcb Dawsh 2y ago
9 4708fcb Dawsh 2y ago export const RouterAdminContext = createContext<RouterAdminContextProps | null>(null);
10 4708fcb Dawsh 2y ago
11 4708fcb Dawsh 2y ago export const useRouterAdminContext = () => {
12 4708fcb Dawsh 2y ago const ctx = useContext(RouterAdminContext);
13 4708fcb Dawsh 2y ago return ctx;
14 4708fcb Dawsh 2y ago };