prototyping the remainder of user reg workflow; some progress on login after register

This commit is contained in:
Mikayla Dobson
2022-12-01 20:59:01 -06:00
parent 671e250c60
commit 8a7eaa7db6
16 changed files with 283 additions and 84 deletions

View File

@@ -33,18 +33,7 @@ export default class AuthService {
password: hash
}
const res: IUser | null = await UserInstance.post(newData);
if (res) receivedUser = res;
// basic profile setup
res && await CollectionInstance.post({
name: `${data.firstname}'s Collection`,
active: true,
ismaincollection: true,
ownerid: res.id!.toString(),
datecreated: now,
datemodified: now
});
await UserInstance.post(newData);
})
return true;

View File

@@ -59,10 +59,8 @@ export const authRoute = (app: Express, passport: PassportStatic) => {
try {
const data: IUser = req.body;
const response = await AuthInstance.register(data);
if (!response) res.sendStatus(400);
// const login = await AuthInstance.login({ email: data.email, password: data.password! });
// console.log(login);
res.status(200).redirect('/');
if (!response) res.status(400).send({ ok: false });
res.status(200).send({ ok: true });
} catch(e) {
next(e);
}