chore: clean up

This commit is contained in:
2024-10-23 10:43:39 +07:00
parent 172566028b
commit c032dbea1a
10 changed files with 195 additions and 270 deletions

View File

@@ -1,17 +1,17 @@
import { commands } from '@/commands.gen'
import { appSettings } from '@/commons'
import { createFileRoute } from '@tanstack/react-router'
import { commands } from "@/commands.gen";
import { appSettings } from "@/commons";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute('/settings/$id/general')({
beforeLoad: async () => {
const res = await commands.getUserSettings()
export const Route = createFileRoute("/settings/$id/general")({
beforeLoad: async () => {
const res = await commands.getUserSettings();
if (res.status === 'ok') {
appSettings.setState((state) => {
return { ...state, ...res.data }
})
} else {
throw new Error(res.error)
}
},
})
if (res.status === "ok") {
appSettings.setState((state) => {
return { ...state, ...res.data };
});
} else {
throw new Error(res.error);
}
},
});