mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
36 lines
665 B
TypeScript
36 lines
665 B
TypeScript
import { create } from 'zustand';
|
|
import { devtools, persist } from 'zustand/middleware';
|
|
import { Region } from '../constants/regions';
|
|
import { NormalizedTankStats } from '../types/tanksStats';
|
|
|
|
type Session = (
|
|
| {
|
|
isTracking: false;
|
|
}
|
|
| {
|
|
isTracking: true;
|
|
|
|
region: Region;
|
|
id: number;
|
|
nickname: string;
|
|
tankStats: NormalizedTankStats;
|
|
time: number;
|
|
}
|
|
) & {
|
|
promptBeforeReset: boolean;
|
|
};
|
|
|
|
export const useSession = create<Session>()(
|
|
devtools(
|
|
persist(
|
|
(set) => ({
|
|
isTracking: false,
|
|
promptBeforeReset: true,
|
|
}),
|
|
{
|
|
name: 'session',
|
|
},
|
|
),
|
|
),
|
|
);
|