From c6e6be3bac6122df9f0bf991fa06dec41b88c62c Mon Sep 17 00:00:00 2001 From: Daniel Klein Date: Fri, 20 Sep 2024 12:51:59 +0200 Subject: [PATCH] feat(datasource): update runtime config for datasource option --- nuxt.config.ts | 1 + server/api/data.get.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 0011f20..6a6c5d0 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -63,6 +63,7 @@ export default defineNuxtConfig({ baseBranch: 'main', repo: 'test-repo', }, + datasource: 'local', }, }, }) diff --git a/server/api/data.get.ts b/server/api/data.get.ts index a6d00d4..a97932e 100644 --- a/server/api/data.get.ts +++ b/server/api/data.get.ts @@ -1,4 +1,6 @@ export default defineEventHandler(async () => { - // return $fetch('https://explorer-data.web3privacy.info/') + const { datasource } = useRuntimeConfig() + if (datasource === 'remote') + return $fetch('https://explorer-data.web3privacy.info/') return await useStorage('assets:server').getItem('data.json') })