mirror of
https://github.com/Radiquum/AniX.git
synced 2025-05-01 18:39:40 +05:00
frontend: add saving of settings state. move logout button in navigation. add close button to settings dialog.
This commit is contained in:
parent
4f680ca717
commit
93982a061c
4 changed files with 78 additions and 23 deletions
25
frontend/app/store/settings-store.js
Normal file
25
frontend/app/store/settings-store.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
"use client";
|
||||
import { create } from "zustand";
|
||||
import { persist, createJSONStorage } from "zustand/middleware";
|
||||
|
||||
function saveSettings(dict) {
|
||||
localStorage.setItem("settings", JSON.stringify(dict));
|
||||
}
|
||||
|
||||
function loadSettings() {
|
||||
return JSON.parse(localStorage.getItem("settings"));
|
||||
}
|
||||
|
||||
export const useSettingsStore = create(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
saveToHistory: true,
|
||||
setSettings: (dict) => {
|
||||
set(dict);
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "settings",
|
||||
},
|
||||
),
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue