feat: migrate session

This commit is contained in:
TrèsAbhi committed 2024-10-07 17:39:20 -05:00
1 parent 8d51ce2bea
commit e234b29e16
5 files changed
+58 -96

No files matched your search

+11 -12
View File
@@ -1,5 +1,5 @@
import { IndividualTankStats, Region, Stat } from '@blitzkit/core';
import lodash from 'lodash-es';
import type { IndividualTankStats, Region, Stat } from '@blitzkit/core';
import { merge } from 'lodash-es';
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { createContextualStore } from '../core/zustand/createContextualStore';
@@ -24,15 +24,14 @@ interface SessionNotTracking extends SessionBase {
type Session = SessionTracking | SessionNotTracking;
export const { Provider, use, useMutation, useStore } = createContextualStore(
() =>
create<Session>()(
persist(
(set) => ({
columns: ['battles', 'winrate', 'wn8', 'averageDamage'],
tracking: false,
}),
{ name: 'session-2', merge: (a, b) => lodash.merge(b, a) },
),
export const Session = createContextualStore(() =>
create<Session>()(
persist(
(set) => ({
columns: ['battles', 'winrate', 'wn8', 'averageDamage'],
tracking: false,
}),
{ name: 'session-2', merge: (a, b) => merge(b, a) },
),
),
);