function authCallback (ctx, result) {
const expires = new Date();
expires.setDate(expires.getDate() + 1);
ctx.cookies.set(‘auth_info’, JSON.stringify(result), {
httpOnly: true,
domain: ‘www.vwood.xyz’,
expires,
});
ctx.redirect(’/’);
}
router.post(’/auth’, async ctx => {
const body = ctx.request.body;
const result = await auth({
email: body.email,
password: body.password,
});
authCallback(ctx, result);
})