36 lines
772 B
JavaScript
36 lines
772 B
JavaScript
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
/**
|
|
* @returns {Promise<{
|
|
* oemId: number,
|
|
* softwareName: string,
|
|
* logoUrl: string | null,
|
|
* wechat: string | null,
|
|
* wechatQrcode: string | null,
|
|
* }>}
|
|
*/
|
|
export async function fetchSoftwareInfo() {
|
|
const empty = {
|
|
oemId: 1,
|
|
softwareName: "",
|
|
logoUrl: null,
|
|
wechat: null,
|
|
wechatQrcode: null,
|
|
};
|
|
try {
|
|
const data = await invoke("get_software_info");
|
|
if (!data || typeof data !== "object") {
|
|
return empty;
|
|
}
|
|
return {
|
|
oemId: data.oemId ?? 1,
|
|
softwareName: data.softwareName ?? "",
|
|
logoUrl: data.logoUrl || null,
|
|
wechat: data.wechat || null,
|
|
wechatQrcode: data.wechatQrcodeUrl || null,
|
|
};
|
|
} catch {
|
|
return empty;
|
|
}
|
|
}
|