Scheduling infrastructure for absolutely everyone.
Fixed incorrect variable & also clears old errors now
Alex van Andelf24ca5b6721d
diff --git a/pages/api/user/profile.ts b/pages/api/user/profile.tsindex fb47f5d221e..cc9aef6a5d1 100644--- a/pages/api/user/profile.ts+++ b/pages/api/user/profile.ts@@ -25,7 +25,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const username = req.body.username;// username is changed: username is optional but it is necessary to be unique, enforce here- if (username !== user.username) {+ if (username !== session.user.username) {const userConflict = await prisma.user.findFirst({where: {username,diff --git a/pages/settings/profile.tsx b/pages/settings/profile.tsxindex 2078796636f..a00f9efaf66 100644--- a/pages/settings/profile.tsx+++ b/pages/settings/profile.tsx@@ -58,7 +58,10 @@ export default function Settings(props) {headers: {'Content-Type': 'application/json'}- }).then(handleError).then( () => setSuccessModalOpen(true) ).catch( (err) => {+ }).then(handleError).then( () => {+ setSuccessModalOpen(true);+ setHasErrors(false); // dismiss any open errors+ }).catch( (err) => {setHasErrors(true);setErrorMessage(err.message);});