view v2 update
This commit is contained in:
18
web/src/stores/bandStore.ts
Normal file
18
web/src/stores/bandStore.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
interface BandState {
|
||||
activeBandId: string | null;
|
||||
setActiveBandId: (id: string | null) => void;
|
||||
}
|
||||
|
||||
function load(): string | null {
|
||||
try { return localStorage.getItem("rh_active_band_id"); } catch { return null; }
|
||||
}
|
||||
|
||||
export const useBandStore = create<BandState>()((set) => ({
|
||||
activeBandId: load(),
|
||||
setActiveBandId: (id) => {
|
||||
try { if (id) localStorage.setItem("rh_active_band_id", id); } catch { /* ignore */ }
|
||||
set({ activeBandId: id });
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user