feat: add tray icon
This commit is contained in:
@@ -112,6 +112,14 @@ async resetPassword(key: string, password: string) : Promise<Result<null, string
|
||||
async getAccounts() : Promise<string[]> {
|
||||
return await TAURI_INVOKE("get_accounts");
|
||||
},
|
||||
async getCurrentAccount() : Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_current_account") };
|
||||
} catch (e) {
|
||||
if(e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
}
|
||||
},
|
||||
async getMetadata(userId: string) : Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_metadata", { userId }) };
|
||||
|
||||
@@ -7,6 +7,19 @@ export const Route = createFileRoute("/")({
|
||||
// Check for app updates
|
||||
await checkForAppUpdates(true);
|
||||
|
||||
// Get current account
|
||||
const checkAccount = await commands.getCurrentAccount();
|
||||
|
||||
if (checkAccount.status === "ok") {
|
||||
const currentAccount = checkAccount.data;
|
||||
|
||||
throw redirect({
|
||||
to: "/$account/chats/new",
|
||||
params: { account: currentAccount },
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Get all accounts from system
|
||||
const accounts = await commands.getAccounts();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user