Files
yaoayanui/src/api/oemSoftwareInfo.js
fengchuanhn@gmail.com 426a69cd69 11
2026-05-21 02:40:08 +08:00

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