Skip to content

Commit

Permalink
Swallow more fetch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Aug 16, 2023
1 parent b418f42 commit 55111c7
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions frontend/src/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,40 @@ export async function fetchEolRebase(appId: string) {
}

export async function fetchEolMessage(appId: string) {
return axios.get<string | undefined>(`${EOL_MESSAGE_URL(appId)}`)
return axios
.get<string | undefined>(`${EOL_MESSAGE_URL(appId)}`)
.catch((error) => {
return {
data: undefined,
}
})
}

export async function fetchSummary(appId: string) {
return axios.get<Summary>(`${SUMMARY_DETAILS(appId)}`)
return axios.get<Summary>(`${SUMMARY_DETAILS(appId)}`).catch((error) => {
return {
data: null,
}
})
}

export async function fetchStats() {
return axios.get<Stats>(`${STATS}`)
return axios.get<Stats>(`${STATS}`).catch((error) => {
return {
data: null,
}
})
}

export async function fetchAppStats(appId: string) {
return axios.get<AppStats>(`${STATS_DETAILS(appId)}`).catch((error) => {
if (error.response.status === 404) {
return {
data: {
installs_per_day: {},
installs_last_7_days: 0,
installs_last_month: 0,
installs_total: 0,
},
}
return {
data: {
installs_per_day: {},
installs_last_7_days: 0,
installs_last_month: 0,
installs_total: 0,
},
}
})
}
Expand Down

0 comments on commit 55111c7

Please sign in to comment.