mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: session persistance
This commit is contained in:
1 parent
57f6e928b7
commit
018783bb47
12 files changed
+121
-29
No files matched your search
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
};
|
||||
|
||||
export const useSession = create<Session>()(
|
||||
devtools(persist((set) => ({ isTracking: false }), { name: 'session' })),
|
||||
);
|
||||
Reference in new issue
Block a user