fix 400 error
This commit is contained in:
parent
3542bfcf17
commit
bd63f02020
@ -1,10 +1,10 @@
|
||||
/* eslint-disable class-methods-use-this */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { Controller, Get, HttpException, HttpStatus, Post, Req, Res } from '@nestjs/common';
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Post, Req, Res } from '@nestjs/common';
|
||||
import { FastifyReply, FastifyRequest } from 'fastify';
|
||||
import { AuthService } from './auth.service';
|
||||
import { COOKIE_TOKEN_NAME } from './lib/constants';
|
||||
import type { Credentials } from './types/request';
|
||||
import { Credentials } from './types/request';
|
||||
|
||||
@Controller()
|
||||
export class AuthController {
|
||||
@ -27,8 +27,8 @@ export class AuthController {
|
||||
}
|
||||
|
||||
@Post('/signin')
|
||||
async login(@Req() req: FastifyRequest, @Res() reply: FastifyReply) {
|
||||
const { login, password } = req.body as Credentials;
|
||||
async login(@Body() credentials: Credentials, @Res() reply: FastifyReply) {
|
||||
const { login, password } = credentials;
|
||||
|
||||
try {
|
||||
const token = await this.authService.login(login, password);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user