Skip to content

Commit

Permalink
Merge pull request #509 from pycontw/fix/ssg-failed-due-to-api-error
Browse files Browse the repository at this point in the history
  • Loading branch information
josix authored Apr 14, 2024
2 parents 3004039 + a6e9ae6 commit 21777f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
18 changes: 4 additions & 14 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down

0 comments on commit 21777f6

Please sign in to comment.