From c60476a062252e29f917ed5631d56bed74610780 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 16 Nov 2022 00:03:12 +0800 Subject: [PATCH] fix: fix gist loading --- server/shared.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/shared.ts b/server/shared.ts index 74f5404a..64d14955 100644 --- a/server/shared.ts +++ b/server/shared.ts @@ -4,8 +4,14 @@ import type { AppInfo } from '~/types' export const registeredApps: Record = {} const runtimeConfig = useRuntimeConfig() -const promise = $fetch(runtimeConfig.registedAppsUrl) - .then(r => Object.assign(registeredApps, r)) +const promise = $fetch(runtimeConfig.registedAppsUrl, { responseType: 'json' }) + .then((r) => { + Object.assign(registeredApps, r) + // eslint-disable-next-line no-console + console.log(`\n${Object.keys(registeredApps).length} registered apps loaded from ${runtimeConfig.registedAppsUrl.split(/\/+/g)[1]}`) + // eslint-disable-next-line no-console + console.log(`${Object.keys(registeredApps).map(i => ` - ${i}`).join('\n')}\n`) + }) .catch((e) => { if (process.dev) console.error('Failed to fetch registered apps,\nyou may need to run `nr register-apps` first')