Merge pull request #32 from web3privacy/dk/data-source-runtime-var

dk/datasource-runtime-var
This commit is contained in:
DanielKlein 2024-09-20 12:59:23 +02:00 committed by GitHub
commit 9e5bd2e299
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -63,6 +63,7 @@ export default defineNuxtConfig({
baseBranch: 'main', baseBranch: 'main',
repo: 'test-repo', repo: 'test-repo',
}, },
datasource: 'local',
}, },
}, },
}) })

View file

@ -1,4 +1,6 @@
export default defineEventHandler(async () => { 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') return await useStorage('assets:server').getItem('data.json')
}) })