FIX: terms of use dynamic language

This commit is contained in:
Gabriel Rosa
2022-10-10 19:56:57 -03:00
parent 5a2c760bab
commit 62730eb969
3 changed files with 14 additions and 5 deletions
+8 -3
View File
@@ -27,6 +27,7 @@ import { AuthClientService } from './auth.service';
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter';
import { RequestUser, User } from 'src/authentication/user.decorator';
import { Metadata } from '@grpc/grpc-js';
@ApiTags('Auth')
@UseFilters(new GrpcToHttpExceptionFilter())
@@ -59,10 +60,14 @@ export class AuthController {
@Post('sign-in')
@HttpCode(HttpStatus.OK)
async signIn(@Body() { username, password, totp }: AuthSignInRequest) {
async signIn(
@Body() { username, password, totp }: AuthSignInRequest,
@Headers('Dadosfera-Lang') language: string,
) {
this.logger.info('/auth - SignIn');
return this.authClient.signIn({ username, password, totp });
const metadata = new Metadata();
metadata.add('language', language || 'pt-br');
return this.authClient.signIn({ username, password, totp }, metadata);
}
@Post('refresh-access-token')