From 11af12a8066f38fe765a866f79c4b6b106bd0d03 Mon Sep 17 00:00:00 2001 From: Peace Date: Tue, 15 Jul 2025 17:35:26 +0900 Subject: [PATCH] fix --- backend/src/auth/auth.service.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts index f604fc2..a77bd59 100755 --- a/backend/src/auth/auth.service.ts +++ b/backend/src/auth/auth.service.ts @@ -21,8 +21,7 @@ export class AuthService { } async login(dto: LoginUserDto) { - try { - const user = await this.userService.findByName(dto.name); + const user = await this.userService.findByName(dto.name); if (!user) throw new UnauthorizedException('Login failed'); const passwordCheck = await bcrypt.compare(dto.password, user.password); @@ -30,20 +29,10 @@ export class AuthService { const payload = { username: user.name, sub: user.id }; return { access_token: this.jwtService.sign(payload) }; - } catch (error) { - if (error instanceof UnauthorizedException) throw error; - - throw new InternalServerErrorException('Login failed (Internal)'); - } } async signup(dto: CreateUserDto) { - try { - const hashed = await bcrypt.hash(dto.password, 10); + const hashed = await bcrypt.hash(dto.password, 10); return this.userService.create({ ...dto, password: hashed }); - } catch (error) { - throw new BadRequestException('Signup failed'); - } - } }