File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,15 +29,12 @@ export function getUserFromRequest(request: NextRequest): User | null {
2929 const authHeader = request . headers . get ( 'authorization' ) ;
3030 if ( authHeader ?. startsWith ( 'Bearer ' ) ) {
3131 const token = authHeader . slice ( 7 ) ;
32- // In production, this would decode and verify the JWT
33- // For now, we'll use the token as userId and check role from cookie
3432 const roleCookie = request . cookies . get ( 'user-role' ) ?. value as UserRole | undefined ;
3533 if ( roleCookie ) {
3634 return {
3735 id : token ,
3836 email : '' ,
3937 role : roleCookie ,
40- createdAt : new Date ( ) . toISOString ( ) ,
4138 } ;
4239 }
4340 }
@@ -49,9 +46,8 @@ export function getUserFromRequest(request: NextRequest): User | null {
4946 id : 'cookie-user' ,
5047 email : '' ,
5148 role : roleCookie ,
52- createdAt : new Date ( ) . toISOString ( ) ,
5349 } ;
5450 }
5551
5652 return null ;
57- }
53+ }
You can’t perform that action at this time.
0 commit comments