13 lines
306 B
TypeScript
13 lines
306 B
TypeScript
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;
|
|
}
|
|
}
|