mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-13 15:36:42 +08:00
Add exit condition for username loop (#1779) by alex-1121
* Add exit condition for username loop Sign out if username prompt is closed. * hiding preloader Co-authored-by: Jack <bartnikjack@gmail.com>
This commit is contained in:
parent
58dd2aa097
commit
0a9f9580f4
2 changed files with 12 additions and 0 deletions
|
@ -2,6 +2,7 @@ import * as Notifications from "./notifications";
|
|||
import * as UpdateConfig from "./config";
|
||||
import * as AccountButton from "./account-button";
|
||||
import * as Account from "./account";
|
||||
import * as AccountController from "./account-controller";
|
||||
import * as CommandlineLists from "./commandline-lists";
|
||||
import * as VerificationController from "./verification-controller";
|
||||
import * as Misc from "./misc";
|
||||
|
@ -121,6 +122,12 @@ export async function signInWithGoogle() {
|
|||
"Please provide a new username (cannot be longer than 16 characters, can only contain letters, numbers, underscores, dots and dashes):"
|
||||
);
|
||||
|
||||
if (name == null) {
|
||||
AccountController.signOut();
|
||||
$(".pageLogin .preloader").addClass("hidden");
|
||||
return;
|
||||
}
|
||||
|
||||
let response;
|
||||
try {
|
||||
response = await axiosInstance.post("/user/checkName", { name });
|
||||
|
|
|
@ -93,6 +93,11 @@ export async function getDataAndInit() {
|
|||
"Please provide a new username (cannot be longer than 16 characters, can only contain letters, numbers, underscores, dots and dashes):"
|
||||
);
|
||||
|
||||
if (name == null) {
|
||||
AccountController.signOut();
|
||||
return;
|
||||
}
|
||||
|
||||
let response;
|
||||
try {
|
||||
response = await axiosInstance.post("/user/updateName", { name });
|
||||
|
|
Loading…
Reference in a new issue