We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents da1dad7 + ff29a09 commit 727c4b6Copy full SHA for 727c4b6
peerprep/api/gateway.ts
@@ -43,13 +43,13 @@ export async function fetchQuestion(
43
);
44
if (!response.ok) {
45
return {
46
- ...(await response.json()),
+ error: await response.text(),
47
status: response.status,
48
};
49
}
50
return (await response.json()) as Question;
51
} catch (err: any) {
52
- return { error: err.message, status: 0 };
+ return { error: err.message, status: 400 };
53
54
55
peerprep/api/structs.ts
@@ -30,5 +30,5 @@ export interface StatusBody {
30
31
32
export function isError(obj: Question | StatusBody): obj is StatusBody {
33
- return (obj as StatusBody).error !== undefined;
+ return (obj as StatusBody).status !== undefined;
34
0 commit comments