Skip to content

Commit

Permalink
feat: add fetch error
Browse files Browse the repository at this point in the history
Signed-off-by: Dup4 <lyuzhi.pan@gmail.com>
  • Loading branch information
Dup4 committed Oct 31, 2023
1 parent cb2723c commit 6012317
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/apps/board/src/composables/useQueryBoardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ async function fetcher(target: string, timestamp?: number): Promise<BoardData> {
const teamsResp = await fetch(`${prefix}/team.json?t=${timestamp ?? 0}`);
const submissionsResp = await fetch(`${prefix}/run.json?t=${timestamp ?? 0}`);

const { status, statusText } = contestResp;
if (status >= 300 || status < 200) {
throw new Error(`fetch data failed. [status=${status}] [statusText=${statusText}]`);
}

const p = Promise.all([
contestResp.json(),
teamsResp.json(),
Expand Down

0 comments on commit 6012317

Please sign in to comment.