feat: rework multi account

This commit is contained in:
reya
2024-10-24 15:50:45 +07:00
parent 469296790e
commit 055d73c829
31 changed files with 979 additions and 1207 deletions
+2 -13
View File
@@ -1,8 +1,7 @@
import { commands } from "@/commands.gen";
import { appSettings } from "@/commons";
import { Outlet, createFileRoute } from "@tanstack/react-router";
export interface RouteSearch {
account?: string;
label?: string;
name?: string;
redirect?: string;
@@ -11,21 +10,11 @@ export interface RouteSearch {
export const Route = createFileRoute("/columns/_layout")({
validateSearch: (search: Record<string, string>): RouteSearch => {
return {
account: search.account,
label: search.label,
name: search.name,
};
},
beforeLoad: async () => {
const res = await commands.getUserSettings();
if (res.status === "ok") {
appSettings.setState((state) => {
return { ...state, ...res.data };
});
} else {
throw new Error(res.error);
}
},
component: Layout,
});