-
This commit is contained in:
12
web/src/lib/invoke.ts
Normal file
12
web/src/lib/invoke.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import {invoke} from "@tauri-apps/api/core";
|
||||
import {toast} from "sonner";
|
||||
|
||||
|
||||
export async function invokeCommand<R>(command: string, data?: Record<string, unknown>): Promise<R> {
|
||||
try {
|
||||
return await invoke<R>(command, data);
|
||||
} catch (e) {
|
||||
toast.error(e as unknown as string);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user