mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-05-18 15:26:36 +00:00
feat(admin/problemset): add Zustand store for new problem state
This commit is contained in:
parent
74e85edd33
commit
623e4929ac
19
src/app/(app)/dashboard/@admin/problemset/new/store.ts
Normal file
19
src/app/(app)/dashboard/@admin/problemset/new/store.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { create } from "zustand";
|
||||||
|
import { createJSONStorage, persist } from "zustand/middleware";
|
||||||
|
import { ProblemSchema } from "@/components/features/dashboard/admin/problemset/new/schema";
|
||||||
|
|
||||||
|
type NewProblemState = Partial<ProblemSchema> & {
|
||||||
|
setData: (data: Partial<ProblemSchema>) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useNewProblemStore = create<NewProblemState>()(
|
||||||
|
persist(
|
||||||
|
(set) => ({
|
||||||
|
setData: (data) => set(data),
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: "new-problem-storage",
|
||||||
|
storage: createJSONStorage(() => localStorage),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user