diff --git a/composables/useFetchRequest.js b/composables/useFetchRequest.js index d269fb72265d2dadd76b52027bede198aab712a4..5d873093f4568f80048d0eca491c1c3b5e0bd4ad 100644 --- a/composables/useFetchRequest.js +++ b/composables/useFetchRequest.js @@ -13,14 +13,9 @@ const useFetchRequest = (baseUrl) => { fetchConfig['Content-Type'] = 'application/json'; } fetchConfig = Object.assign(config, fetchConfig); - return window.fetch(url, fetchConfig).then(async (response) => { - let result = await response.text() - try { - result = JSON.parse(result) - } catch(error) { - console.log(error) - } - return result; + return $fetch(url, fetchConfig).then(async (response) => { + console.log(`response:`, response) + return response; }).finally(() => { loading.value = false }) diff --git a/pages/index.vue b/pages/index.vue index 7138d37c1c5df44cc93ccdee902ba6f1f0612084..2ae0f07811350966c3eb01cf907b0075d2de22d0 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -24,8 +24,8 @@