working sign up and sign in as far as I know

This commit is contained in:
talksik
2022-03-18 10:21:38 -04:00
parent 3488278d2d
commit aca9c5a12d
9 changed files with 79 additions and 30 deletions
-3
View File
@@ -13,7 +13,6 @@ export const authCheck = async (
next: NextFunction
) => {
const { authorization } = req.headers;
console.log(authorization);
try {
const ticket = await client.verifyIdToken({
@@ -28,8 +27,6 @@ export const authCheck = async (
res.locals.userId = userId;
res.locals.email = email;
console.log(userId);
next();
} catch (error) {
res.status(401).send("unauthorized");
+4 -1
View File
@@ -61,10 +61,13 @@ async function getUserDetails(req: Request, res: Response) {
// create user if not exists
const insertResult = await UserService.createUserIfNotExists(newUser);
newUser._id = insertResult?.insertedId;
insertResult
? res.status(200).send("User created")
? res.status(200).send(newUser)
: res.status(500).send("Failed to create account, already exists");
return;
}
// otherwise, just return the user details