File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import type { FastifyInstance , FastifyRequest , FastifyReply } from 'fastify' ;
1+ import { getPlatform , getProfileUrl , getWebViewUrl } from '@devcard/shared' ;
2+
23import { decrypt } from '../utils/encryption.js' ;
34import { getErrorMessage } from '../utils/error.util.js' ;
4- import { getPlatform , getProfileUrl , getWebViewUrl } from '@devcard/shared' ;
55import { followLogSchema } from '../validations/follow.validation.js' ;
6+
67import type { AuthenticatedUser } from '../types/fastify.js' ;
8+ import type { FastifyInstance , FastifyRequest , FastifyReply } from 'fastify' ;
79
8- export async function followRoutes ( app : FastifyInstance ) {
10+ export async function followRoutes ( app : FastifyInstance ) : Promise < void > {
911 app . addHook ( 'preHandler' , async ( request , reply ) => {
1012 const server = request . server ;
1113 if ( typeof server ?. authenticate === 'function' ) { await server . authenticate ( request , reply ) ; return }
1214 if ( typeof app . authenticate === 'function' ) { await app . authenticate ( request , reply ) ; return }
13- try { const payload = await request . jwtVerify < AuthenticatedUser > ( ) ; if ( payload ) request . user = payload ; } catch ( e ) { reply . status ( 401 ) . send ( { error : 'Unauthorized' } ) }
15+ try { const payload = await request . jwtVerify < AuthenticatedUser > ( ) ; if ( payload ) { request . user = payload ; } } catch ( _e ) { reply . status ( 401 ) . send ( { error : 'Unauthorized' } ) }
1416 } ) ;
1517
1618 // ─── Follow via API (Layer 1) ───
You can’t perform that action at this time.
0 commit comments