fix: preventing page reload on form submit

This commit is contained in:
Chubby Granny Chaser 2024-06-19 09:59:59 +01:00
parent 1fb1c9e81a
commit 61c5fc3957
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -46,10 +46,8 @@ export function useUserDetails() {
); );
} else { } else {
dispatch(setProfileBackground(null)); dispatch(setProfileBackground(null));
window.localStorage.setItem(
"userDetails", window.localStorage.setItem("userDetails", JSON.stringify(userDetails));
JSON.stringify({ ...userDetails })
);
} }
}, },
[dispatch] [dispatch]

View File

@ -49,7 +49,10 @@ export const UserEditProfileModal = ({
} }
}; };
const handleSaveProfile = async () => { const handleSaveProfile: React.FormEventHandler<HTMLFormElement> = async (
event
) => {
event.preventDefault();
setIsSaving(true); setIsSaving(true);
patchUser(displayName, newImagePath) patchUser(displayName, newImagePath)