From 75167ae9e7291c3b2be5fd0704849d499e855eb9 Mon Sep 17 00:00:00 2001 From: Jeffrey Hsu Date: Wed, 1 Jan 2025 23:27:27 +0800 Subject: [PATCH] add timeout --- composables/network.ts | 1 + pages/index.vue | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composables/network.ts b/composables/network.ts index 984b7fb..ca4608f 100644 --- a/composables/network.ts +++ b/composables/network.ts @@ -6,6 +6,7 @@ export function requestCore(url: string, options: UseFetchOptions) return useFetch(url, { baseURL: "https://cantyonion.site", retry: false, + timeout: 3000, onRequest({ options }) { let token: string = "" if (import.meta.client) { diff --git a/pages/index.vue b/pages/index.vue index 782e075..f79afcb 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -73,8 +73,7 @@ const reloadActivities = async () => { } } -await reloadPosts() -await reloadActivities() +await Promise.all([reloadPosts(), reloadActivities()]) onMounted(() => { $mitt.emit('startLoading', false)