diff --git a/Src/Firebase/users.ts b/Src/Firebase/users.ts index c52ae01..9fe62b3 100644 --- a/Src/Firebase/users.ts +++ b/Src/Firebase/users.ts @@ -136,10 +136,8 @@ export async function userLogin( ); } //hashes password in routes intill i know a better way -export async function updateUser(user: User) { - if (!isValidUser(user)) { - throw new BaseError('User is not valid', 400); - } +export async function updateUser(user: User): Promise { + const updateUser = doc(db, 'users', `${user.id}`); await updateDoc(updateUser, { firstName: user.firstName, @@ -150,6 +148,7 @@ export async function updateUser(user: User) { if (!updateUser) { throw new BaseError('User not found', 404); } + return user; } export async function deleteUser(user: User) { diff --git a/Src/routes/users.ts b/Src/routes/users.ts index 68ab5e5..6838622 100644 --- a/Src/routes/users.ts +++ b/Src/routes/users.ts @@ -112,8 +112,8 @@ router.put( password: hashedPassword || user.password, orgId: [parseInt(req.params.orgId)], }; - updateUser(updatedUser); - res.status(204).end(); + const newUserInfo = await updateUser(updatedUser); + res.json(newUserInfo); }), );