首页应用列表完成

This commit is contained in:
柚子
2025-01-22 20:10:03 +08:00
parent e0933216d4
commit b2f458f3b8
11 changed files with 241 additions and 64 deletions

View File

@@ -1,6 +1,6 @@
import { invoke } from "@tauri-apps/api/core";
import { retryOperation } from "../utils";
import { HomeLink, HomeLinkResponse } from "@/types/home";
import { HomeLink, HomeLinkResponse, HomeList, HomeListApp } from "@/types/home";
export const getHomeLinks = async (): Promise<HomeLink[]> => {
try {
@@ -18,4 +18,26 @@ export const getHomeLinks = async (): Promise<HomeLink[]> => {
console.error("获取主页链接列表失败:", error);
throw new Error("获取主页链接列表失败");
}
};
export const getHomeLists = async (): Promise<HomeList[]> => {
try {
return await retryOperation(async () => {
return await invoke<HomeList[]>("get_home_lists");
});
} catch (error) {
console.error("获取首页列表失败:", error);
throw new Error("获取首页列表失败");
}
};
export const getListApps = async (jsonUrl: string): Promise<HomeListApp[]> => {
try {
return await retryOperation(async () => {
return await invoke<HomeListApp[]>("get_home_list_apps", { jsonUrl });
});
} catch (error) {
console.error("获取列表应用数据失败:", error);
throw new Error("获取列表应用数据失败");
}
};