fix: inbox relay isn't connect when send message in compose dialog

This commit is contained in:
reya
2024-08-06 10:05:52 +07:00
parent c3334d91cf
commit 01284db42e
14 changed files with 193 additions and 111 deletions

View File

@@ -36,6 +36,22 @@ try {
else return { status: "error", error: e as any };
}
},
async connectInboxRelays(userId: string, ignoreCache: boolean) : Promise<Result<string[], string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("connect_inbox_relays", { userId, ignoreCache }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
},
async disconnectInboxRelays(userId: string) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("disconnect_inbox_relays", { userId }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
},
async login(account: string, password: string) : Promise<Result<string, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("login", { account, password }) };
@@ -111,22 +127,6 @@ try {
else return { status: "error", error: e as any };
}
},
async connectInbox(id: string) : Promise<Result<string[], string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("connect_inbox", { id }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
},
async disconnectInbox(id: string) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("disconnect_inbox", { id }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
},
async sendMessage(to: string, message: string) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("send_message", { to, message }) };