Give user feedback if the rageshake submission failed (#2621)

This commit is contained in:
Hugh Nimmo-Smith
2024-09-11 14:53:50 +01:00
committed by GitHub
parent 5fda7fa220
commit a5aeb6f324
2 changed files with 12 additions and 9 deletions

View File

@@ -270,11 +270,17 @@ export function useSubmitRageshake(): {
);
}
await fetch(Config.get().rageshake!.submit_url, {
const res = await fetch(Config.get().rageshake!.submit_url, {
method: "POST",
body,
});
if (res.status !== 200) {
throw new Error(
`Failed to submit feedback: receive HTTP ${res.status} ${res.statusText}`,
);
}
setState({ sending: false, sent: true, error: undefined });
} catch (error) {
setState({ sending: false, sent: false, error: error as Error });