feat: initial commit
This commit is contained in:
27
src/store/test-store.ts
Normal file
27
src/store/test-store.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { create } from "zustand"
|
||||
import { persist } from "zustand/middleware"
|
||||
|
||||
interface TestState {
|
||||
// Shell — filled during TOEIC feature implementation
|
||||
currentPart: number | null
|
||||
answers: Record<string, string>
|
||||
setCurrentPart: (part: number | null) => void
|
||||
setAnswer: (questionId: string, answer: string) => void
|
||||
reset: () => void
|
||||
}
|
||||
|
||||
export const useTestStore = create<TestState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
currentPart: null,
|
||||
answers: {},
|
||||
setCurrentPart: (part) => set({ currentPart: part }),
|
||||
setAnswer: (questionId, answer) =>
|
||||
set((state) => ({
|
||||
answers: { ...state.answers, [questionId]: answer },
|
||||
})),
|
||||
reset: () => set({ currentPart: null, answers: {} }),
|
||||
}),
|
||||
{ name: "test-store" },
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user