creating dynamic route for the team and fixing other things

This commit is contained in:
Arjun Patel
2022-01-14 01:51:06 -08:00
parent c05c5af384
commit 320fd5bd0a
3 changed files with 24 additions and 2 deletions
+8 -2
View File
@@ -44,7 +44,7 @@ export default function Profile() {
})();
}, [])
function handleSubmit() {
async function handleSubmit() {
if (!firstName) {
setError('Must input first name')
return
@@ -67,7 +67,13 @@ export default function Profile() {
newUser.nickName = nickname
newUser.avatarUrl = currUser.photoURL
userService.updateUser(newUser)
try {
await userService.updateUser(newUser)
router.push('/teams')
}
catch(error) {
setError('Something went wrong in saving your information. Please try again.')
}
}
const [firstName, setFirstName] = useState<string>(currUser.displayName.split(" ")[0]);