mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Package updates
update types in /api/users/login to avoid tsc error
This commit is contained in:
@@ -9,6 +9,7 @@ import { z } from 'zod';
|
||||
import LoginValidationSchema from '@/services/User/schema/LoginValidationSchema';
|
||||
import { UserExtendedNextApiRequest } from '@/config/auth/types';
|
||||
import validateRequest from '@/config/nextConnect/middleware/validateRequest';
|
||||
import GetUserSchema from '@/services/User/schema/GetUserSchema';
|
||||
|
||||
const router = createRouter<
|
||||
UserExtendedNextApiRequest,
|
||||
@@ -20,14 +21,18 @@ router.post(
|
||||
expressWrapper(async (req, res, next) => {
|
||||
passport.initialize();
|
||||
passport.use(localStrat);
|
||||
passport.authenticate('local', { session: false }, (error, token) => {
|
||||
if (error) {
|
||||
next(error);
|
||||
return;
|
||||
}
|
||||
req.user = token;
|
||||
next();
|
||||
})(req, res, next);
|
||||
passport.authenticate(
|
||||
'local',
|
||||
{ session: false },
|
||||
(error: unknown, token: z.infer<typeof GetUserSchema>) => {
|
||||
if (error) {
|
||||
next(error);
|
||||
return;
|
||||
}
|
||||
req.user = token;
|
||||
next();
|
||||
},
|
||||
)(req, res, next);
|
||||
}),
|
||||
async (req, res) => {
|
||||
const user = req.user!;
|
||||
|
||||
Reference in New Issue
Block a user