mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
fixed last result not begin saved when using google sign in. closes #3040
This commit is contained in:
parent
2263c5d069
commit
dc96308f94
1 changed files with 16 additions and 17 deletions
|
|
@ -256,6 +256,22 @@ export async function loadUser(user: UserType): Promise<void> {
|
|||
if (VerificationController.data !== null) {
|
||||
VerificationController.verify(user.uid);
|
||||
}
|
||||
|
||||
if (TestLogic.notSignedInLastResult !== null) {
|
||||
TestLogic.setNotSignedInUid(user.uid);
|
||||
|
||||
const response = await Ape.results.save(TestLogic.notSignedInLastResult);
|
||||
|
||||
if (response.status !== 200) {
|
||||
return Notifications.add(
|
||||
"Failed to save last result: " + response.message,
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
TestLogic.clearNotSignedInResult();
|
||||
Notifications.add("Last test result saved", 1);
|
||||
}
|
||||
}
|
||||
|
||||
const authListener = Auth.onAuthStateChanged(async function (user) {
|
||||
|
|
@ -313,23 +329,6 @@ export function signIn(): void {
|
|||
return signInWithEmailAndPassword(Auth, email, password)
|
||||
.then(async (e) => {
|
||||
await loadUser(e.user);
|
||||
if (TestLogic.notSignedInLastResult !== null) {
|
||||
TestLogic.setNotSignedInUid(e.user.uid);
|
||||
|
||||
const response = await Ape.results.save(
|
||||
TestLogic.notSignedInLastResult
|
||||
);
|
||||
|
||||
if (response.status !== 200) {
|
||||
return Notifications.add(
|
||||
"Failed to save last result: " + response.message,
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
TestLogic.clearNotSignedInResult();
|
||||
Notifications.add("Last test result saved", 1);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
let message = error.message;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue