From a6e9ae6ac6dab493ab70f4cb9f060dade2c09cc6 Mon Sep 17 00:00:00 2001 From: josix Date: Fri, 12 Apr 2024 16:58:41 +0800 Subject: [PATCH] fixup! fix: prevent generation failed due to 4xx, 5xx api error --- nuxt.config.js | 18 ++++-------------- store/index.js | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index f38919d6cc..46f26a253c 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -17,25 +17,18 @@ export default { `${DEFAULT_BASE_URL}/api/events/speeches/?event_types=talk,sponsored`, config, ) - .catch((error) => { - if (error.response.status === 404) { - return { data: [] } - } + .catch((error) => { // eslint-disable-line + return { data: [] } }) const tutorials = await axios .get( `${DEFAULT_BASE_URL}/api/events/speeches/?event_types=tutorial`, config, ) - .catch((error) => { - if (error.response.status === 404) { - return { data: [] } - } + .catch((error) => { // eslint-disable-line + return { data: [] } }) const getAllDetailTalks = async () => { - if (!talks.data) { - return [] - } const data = await Promise.all( talks.data.map(async (talk) => { return await axios @@ -49,9 +42,6 @@ export default { return data } const getAllDetailTutorials = async () => { - if (!tutorials.data) { - return [] - } const data = await Promise.all( tutorials.data.map(async (tutorial) => { return await axios diff --git a/store/index.js b/store/index.js index e7c79f91a1..c51940c322 100644 --- a/store/index.js +++ b/store/index.js @@ -55,7 +55,7 @@ export const actions = { }, async $getSchedulesData({ commit }) { const { data } = await this.$http.$get('/api/events/schedule/') - if (!data) return + if (!data) return // FIXME: should be removed after API fixed commit('setSchedulesData', data) }, async $getKeynotesData({ commit }) {