mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
fix logout
This commit is contained in:
@@ -21,11 +21,7 @@ router.all(async (req, res) => {
|
||||
|
||||
removeTokenCookie(res);
|
||||
|
||||
res.status(200).json({
|
||||
message: 'Logged out.',
|
||||
statusCode: 200,
|
||||
success: true,
|
||||
});
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
const handler = router.handler(NextConnectOptions);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { setLoginSession } from '@/config/auth/session';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { z } from 'zod';
|
||||
import ServerError from '@/config/util/ServerError';
|
||||
@@ -35,6 +36,11 @@ const registerUser = async (req: RegisterUserRequest, res: NextApiResponse) => {
|
||||
}
|
||||
|
||||
const user = await createNewUser(req.body);
|
||||
|
||||
await setLoginSession(res, {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
});
|
||||
res.status(201).json({
|
||||
message: 'User created successfully.',
|
||||
payload: user,
|
||||
|
||||
Reference in New Issue
Block a user