19 lines
502 B
TypeScript
19 lines
502 B
TypeScript
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 });
|
|
},
|
|
}));
|