turkmentv_front/store/store.ts

58 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2025-03-14 10:46:10 +00:00
import { ISearchNetije } from "@/models/quizQuestionsWinners.model";
import { create } from "zustand";
interface ILotteryStatus {
status: "Upcoming" | "Finished" | "Ongoing";
setStatus: (value: "Upcoming" | "Finished" | "Ongoing") => void;
}
2025-02-24 11:45:37 +00:00
interface IQuizSearch {
active: boolean;
setActive: (value: boolean) => void;
}
2025-03-07 10:18:56 +00:00
interface IStep {
step: number | null;
setStep: (value: number | null) => void;
}
2025-03-14 10:46:10 +00:00
interface ILoading {
loading: boolean;
setLoading: (value: boolean) => void;
}
interface IQuizResults {
resultData: ISearchNetije[];
setResultData: (value: ISearchNetije[]) => void;
error: string;
setError: (value: string) => void;
}
export const useLotteryStatus = create<ILotteryStatus>((set) => ({
status: "Upcoming",
setStatus: (value: "Upcoming" | "Finished" | "Ongoing") =>
set({ status: value }),
}));
2025-02-24 11:45:37 +00:00
export const useQuizSearchActive = create<IQuizSearch>((set) => ({
active: false,
setActive: (value: boolean) => set({ active: value }),
}));
2025-03-07 10:18:56 +00:00
export const useSteps = create<IStep>((set) => ({
step: null,
setStep: (value: number | null) => set({ step: value }),
}));
2025-03-14 10:46:10 +00:00
export const useQuizResults = create<IQuizResults>((set) => ({
resultData: [],
setResultData: (value: ISearchNetije[]) => set({ resultData: value }),
error: "",
setError: (value: string) => set({ error: value }),
}));
export const useResultsLoading = create<ILoading>((set) => ({
loading: false,
setLoading: (value: boolean) => set({ loading: value }),
}));