16 lines
461 B
TypeScript
16 lines
461 B
TypeScript
import { create } from 'zustand'
|
|
|
|
interface SettingsState {
|
|
config: Record<string, string>
|
|
loaded: boolean
|
|
setConfig: (config: Record<string, string>) => void
|
|
updateKey: (key: string, value: string) => void
|
|
}
|
|
|
|
export const useSettingsStore = create<SettingsState>((set) => ({
|
|
config: {},
|
|
loaded: false,
|
|
setConfig: (config) => set({ config, loaded: true }),
|
|
updateKey: (key, value) => set((s) => ({ config: { ...s.config, [key]: value } })),
|
|
}))
|