From d19cadf8cea7131df095d9f7d489b4792063b2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Sat, 10 Sep 2022 12:07:12 +0900 Subject: [PATCH] nestjs_auth... --- src/auth/auth.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 2b149cd..46c1380 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -17,19 +17,19 @@ export class AuthService { ) {} //app.controller.ts에서 @UseGuards(AuthGuard('local'))용 - async validateUser(email: string, password: string): Promise | null { + async validateUser(email: string, password: string): Promise { const user = await this.userService.fetchOne({ email: email }) if (user && user.password === password) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { password, ...result } = user // result는 password 를 제외한 user의 모든 정보를 포함한다. //console.log(result) - console.log(password) return result } return null } - async getTokens(user: User): Promise { + getTokens(user: User) { //console.log(user) const access_token_payload = { email: user.email, @@ -51,13 +51,13 @@ export class AuthService { } } - async login(email: string, password: string): Promise | null { + async login(email: string, password: string): Promise { const user = await this.validateUser(email, password) if (!user) return null return await this.getTokens(user) } - async register(data: UserDTO): Promise | null { + async register(data: UserDTO): Promise { const user = await this.userService.add(data) if (!user) return null return await this.getTokens(user)