23 lines
521 B
TypeScript
23 lines
521 B
TypeScript
|
|
import { Question } from "@model/question/question";
|
||
|
|
import { create } from "zustand";
|
||
|
|
import { devtools } from "zustand/middleware";
|
||
|
|
|
||
|
|
|
||
|
|
export type QuestionsStore = {
|
||
|
|
questionsById: Record<number, Question | undefined>;
|
||
|
|
};
|
||
|
|
|
||
|
|
const initialState: QuestionsStore = {
|
||
|
|
questionsById: {},
|
||
|
|
};
|
||
|
|
|
||
|
|
export const useQuestionsStore = create<QuestionsStore>()(
|
||
|
|
devtools(
|
||
|
|
() => initialState,
|
||
|
|
{
|
||
|
|
name: "QuestionsStore",
|
||
|
|
enabled: process.env.NODE_ENV === "development",
|
||
|
|
}
|
||
|
|
)
|
||
|
|
);
|