Only show `alert` once when TOS changes

pull/692/head
Rick Carlino 2018-03-02 08:36:17 -06:00
parent d90c29af8a
commit 6e2b64b39c
1 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@ export function responseFulfilled(input: AxiosResponse): AxiosResponse {
return input;
}
let ONLY_ONCE = true;
export function responseRejected(x: SafeError | undefined) {
if (x && isSafeError(x)) {
dispatchNetworkUp("user.api");
@ -50,7 +51,8 @@ export function responseRejected(x: SafeError | undefined) {
break;
case 451:
// DONT REFACTOR: I want to use alert() because it's blocking.
alert(t(Content.TOS_UPDATE));
ONLY_ONCE && alert(t(Content.TOS_UPDATE));
ONLY_ONCE = false;
window.location.href = "/tos_update";
break;
}