mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
removed console log, checking return value
This commit is contained in:
parent
c732b441f4
commit
29ab060054
|
@ -457,16 +457,17 @@ exports.removeSmallTestsAndQPB = functions.https.onCall(
|
|||
|
||||
exports.resetPersonalBests = functions.https.onCall(
|
||||
async (request, response) => {
|
||||
console.log("heyheyhey");
|
||||
let uid = request.uid;
|
||||
|
||||
try {
|
||||
var user = await db.collection("users").doc(uid);
|
||||
await user.update({ personalBests: {} });
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.log(
|
||||
`something went wrong when deleting personal bests for ${uid}: ${e.message}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -240,12 +240,22 @@ simplePopups.resetPersonalBests = new SimplePopup(
|
|||
|
||||
CloudFunctions.resetPersonalBests({
|
||||
uid: firebase.auth().currentUser.uid,
|
||||
}).then(() => {
|
||||
hideBackgroundLoader();
|
||||
Notifications.add("Personal bests removed, refreshing the page...", 0);
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
}).then((res) => {
|
||||
if (res) {
|
||||
hideBackgroundLoader();
|
||||
Notifications.add(
|
||||
"Personal bests removed, refreshing the page...",
|
||||
0
|
||||
);
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
Notifications.add(
|
||||
"Something went wrong while removing personal bests...",
|
||||
-1
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
Notifications.add("Something went wrong: " + e, -1);
|
||||
|
|
Loading…
Reference in a new issue