system-copyright-react/src/context/GlobalContext.ts

32 lines
606 B
TypeScript
Raw Normal View History

2024-03-26 21:09:41 +08:00
import {createContext, Dispatch} from "react";
export enum GlobalDataActionType {
REFRESH_SELF
}
export interface User {
balance: string;
nickname: string;
username: string;
hasUserInfo: boolean;
}
2024-03-26 11:54:30 +08:00
export interface GlobalData {
2024-03-26 21:09:41 +08:00
user: User;
2024-03-26 11:54:30 +08:00
}
2024-03-26 21:09:41 +08:00
export interface GlobalDataAction {
type: number;
user?: User;
}
export const GlobalContext = createContext<GlobalData>({
user: {
balance: '0',
nickname: '',
username: '',
hasUserInfo: false
}
});
export const GlobalDispatchContext = createContext<Dispatch<GlobalDataAction>>(() => {});