Created a route for the Stripe webhook
This commit is contained in:
@@ -37,7 +37,7 @@ async function login(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const codeData = codeDocs[0].data() as {code: string; type: Type; creator: string; expiryDate: Date | null};
|
||||
const codeData = codeDocs[0].data() as {code: string; type: Type; creator?: string; expiryDate: Date | null};
|
||||
|
||||
createUserWithEmailAndPassword(auth, email, password)
|
||||
.then(async (userCredentials) => {
|
||||
@@ -57,7 +57,7 @@ async function login(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
await setDoc(doc(db, "users", userId), user);
|
||||
await setDoc(codeDocs[0].ref, {userId: userId}, {merge: true});
|
||||
await addUserToGroupOnCreation(userId, codeData.type, codeData.creator);
|
||||
if (codeData.creator) await addUserToGroupOnCreation(userId, codeData.type, codeData.creator);
|
||||
|
||||
req.session.user = {...user, id: userId};
|
||||
await req.session.save();
|
||||
|
||||
Reference in New Issue
Block a user