Give user feedback if the rageshake submission failed (#2621)
This commit is contained in:
@@ -69,9 +69,7 @@ export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
|
|||||||
disabled={sending || sent}
|
disabled={sending || sent}
|
||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
{sent ? (
|
{!sent && (
|
||||||
<Body> {t("settings.feedback_tab_thank_you")}</Body>
|
|
||||||
) : (
|
|
||||||
<FieldRow>
|
<FieldRow>
|
||||||
<InputField
|
<InputField
|
||||||
id="sendLogs"
|
id="sendLogs"
|
||||||
@@ -80,16 +78,15 @@ export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
defaultChecked
|
defaultChecked
|
||||||
/>
|
/>
|
||||||
{error && (
|
|
||||||
<FieldRow>
|
|
||||||
<ErrorMessage error={error} />
|
|
||||||
</FieldRow>
|
|
||||||
)}
|
|
||||||
<Button type="submit" disabled={sending}>
|
<Button type="submit" disabled={sending}>
|
||||||
{sending ? t("submitting") : t("action.submit")}
|
{sending ? t("submitting") : t("action.submit")}
|
||||||
</Button>
|
</Button>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
)}
|
)}
|
||||||
|
<FieldRow>
|
||||||
|
{error && <ErrorMessage error={error} />}
|
||||||
|
{sent && <Body> {t("settings.feedback_tab_thank_you")}</Body>}
|
||||||
|
</FieldRow>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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",
|
method: "POST",
|
||||||
body,
|
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 });
|
setState({ sending: false, sent: true, error: undefined });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setState({ sending: false, sent: false, error: error as Error });
|
setState({ sending: false, sent: false, error: error as Error });
|
||||||
|
|||||||
Reference in New Issue
Block a user