- Real Grid 컴포넌트 @rsone/components 로 모듈화 - 컴포넌트 동적 import 경로 수정(engName -> urlPath)
26 lines
648 B
TypeScript
26 lines
648 B
TypeScript
import { create } from "zustand";
|
|
|
|
export type AlertState = {
|
|
message: string;
|
|
callback?: () => void;
|
|
};
|
|
|
|
export type AlertActions = {
|
|
setMessage: (message: string, callback?: () => void) => void;
|
|
};
|
|
|
|
export type AlertStore = AlertState & AlertActions;
|
|
|
|
interface AlertStoreState extends AlertStore {}
|
|
|
|
const useAlertStoreHook = create<AlertStoreState>((set) => ({
|
|
message: "",
|
|
callback: undefined,
|
|
setMessage: (message: string, callback?: () => void) =>
|
|
set(() => ({ message, callback })),
|
|
}));
|
|
|
|
export const useAlertStore = useAlertStoreHook;
|
|
export const getAlertStoreState = () => useAlertStoreHook.getState();
|
|
|