Something went wrong. Try again.
A social knowledge tool for research trails, built on ATProto semble.so
research-tool social-network tools-for-thought atproto
Something went wrong. Try again.
908 B · 31 lines
TypeScript
at development
1234567891011121314151617181920212223242526272829303132import { Controller } from '../../../../../shared/infrastructure/http/Controller';import { Request, Response } from 'express';import { RefreshAccessTokenUseCase } from '../../../application/use-cases/RefreshAccessTokenUseCase';
export class RefreshAccessTokenController extends Controller { constructor(private refreshAccessTokenUseCase: RefreshAccessTokenUseCase) { super(); }
async executeImpl(req: Request, res: Response): Promise<any> { try { const { refreshToken } = req.body;
if (!refreshToken) { return this.badRequest(res, 'Refresh token is required'); }
const result = await this.refreshAccessTokenUseCase.execute({ refreshToken, });
if (result.isErr()) { return this.fail(res, result.error); }
return this.ok(res, result.value); } catch (error: any) { return this.fail(res, error); } }}