Open prevent redirect to /profile/undefined when going to the page of a non-existing profile(#3725) FurriousFox

fix it automatically changing the url in the url bar (which gets requested if someone reloads the page) to https://monkeytype.com/profile/undefined (which apparently is already the username of an existing user) when going to the profile of a non-existent user (for ex. https://monkeytype.com/profile/dfjksahjkadfsjhkasfhjkadhjksf )
This commit is contained in:
Micha 2022-11-08 12:27:16 +01:00 committed by GitHub
parent d8b5f818c7
commit 192cd999ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -170,10 +170,10 @@ async function update(options: UpdateOptions): Promise<void> {
"Failed to load profile: " + response.message,
-1
);
} else {
window.history.replaceState(null, "", `/profile/${response.data.name}`);
}
window.history.replaceState(null, "", `/profile/${response.data.name}`);
Profile.update("profile", response.data);
PbTables.update(response.data.personalBests, true);
} else {