turkmentv_front/store/useLotteryAuth.ts

31 lines
726 B
TypeScript
Raw Normal View History

2024-12-27 15:23:39 +00:00
import { create } from 'zustand';
import { ILotteryResponse } from '@/models/lottery/lottery.model';
2024-12-23 19:13:36 +00:00
interface LotteryAuthState {
isAuthenticated: boolean;
lotteryData: ILotteryResponse | null;
2024-12-27 15:23:39 +00:00
phone: string | null;
code: string | null;
setAuth: (data: ILotteryResponse, phone: string, code: string) => void;
2024-12-23 19:13:36 +00:00
logout: () => void;
}
2024-12-27 15:23:39 +00:00
export const useLotteryAuth = create<LotteryAuthState>((set) => ({
isAuthenticated: false,
lotteryData: null,
phone: null,
code: null,
setAuth: (data, phone, code) => set({
isAuthenticated: true,
lotteryData: data,
phone,
code
}),
logout: () => set({
isAuthenticated: false,
lotteryData: null,
phone: null,
code: null
}),
}));