feat: add tray icon

This commit is contained in:
2024-09-19 08:59:17 +07:00
parent d03865eeaa
commit 82500b35f4
7 changed files with 125 additions and 16 deletions

View File

@@ -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 }) };

View File

@@ -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();