From 9f50e25dc09cc0bf1d8e68cefb6843aa9bd8b7e6 Mon Sep 17 00:00:00 2001 From: Elysia Date: Sat, 14 Feb 2026 18:58:29 +0800 Subject: [PATCH] feat(app): add cache buster for API requests close #16 --- src/App.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 341c61ae..f4c1e08c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -151,6 +151,7 @@ const axiosInstance = axios.create({ baseURL: APM_STORE_BASE_URL, timeout: 5000, // 增加到 5 秒,避免网络波动导致的超时 }); +const cacheBuster = (url: string) => `${url}?cb=${Date.now()}`; // 响应式状态 const themeMode = ref<"light" | "dark" | "auto">("auto"); @@ -621,7 +622,7 @@ const openDownloadedApp = (pkgname: string) => { const loadCategories = async () => { try { const response = await axiosInstance.get( - `/${window.apm_store.arch}/categories.json`, + cacheBuster(`/${window.apm_store.arch}/categories.json`), ); categories.value = response.data; } catch (error) { @@ -639,7 +640,7 @@ const loadApps = async () => { try { logger.info(`加载分类: ${category}`); const response = await axiosInstance.get( - `/${window.apm_store.arch}/${category}/applist.json`, + cacheBuster(`/${window.apm_store.arch}/${category}/applist.json`), ); const categoryApps = response.status === 200 ? response.data : [];