import * as Hapi from '@hapi/hapi' ; import * as Joi from 'joi' ; import { internal } from '@hapi/boom' ; import { invalidateToken } from '@auth/features/invalidateToken/service' ; interface IInvalidateTokenPayload { token : string ; } export default async function invalidateTokenHandler ( request , h ) { const { token } = request . payload as IInvalidateTokenPayload ; try { await invalidateToken ( token ) ; } catch ( err ) { throw internal ( 'Failed to invalidate token' , err ) ; } return { } ; } export const reqInvalidateTokenSchema = Joi . object ( { token : Joi . string ( ) } ) ;