diff --git a/composables/network.ts b/composables/network.ts index 7388e16..984b7fb 100644 --- a/composables/network.ts +++ b/composables/network.ts @@ -2,6 +2,7 @@ import type { AsyncData, UseFetchOptions } from '#app' export function requestCore(url: string, options: UseFetchOptions) { // const config = useRuntimeConfig() + const {$mitt} = useNuxtApp() return useFetch(url, { baseURL: "https://cantyonion.site", retry: false, @@ -25,7 +26,7 @@ export function requestCore(url: string, options: UseFetchOptions) // } }, onResponseError({ response }) { - emitter.emit('eventBus', { + $mitt.emit('eventBus', { level: 'error', title: `HTTP错误:${response.status}`, message: response.statusText