-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from boostcampwm2023/feat/103-diary-update-re…
…sponse-handling [Feat] 일기 수정 API에 대한 서버 응답 수정 및 e2e 테스트 작성
- Loading branch information
Showing
14 changed files
with
446 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Injectable, UnauthorizedException } from "@nestjs/common"; | ||
import { AuthGuard as NestAuthGuard } from "@nestjs/passport"; | ||
|
||
@Injectable() | ||
export class JwtAuthGuard extends NestAuthGuard("jwt") { | ||
handleRequest(err, user, info: Error) { | ||
if (err || !user) { | ||
if (info.message === "No auth token") { | ||
throw new UnauthorizedException("비로그인 상태의 요청입니다."); | ||
} else if (info.message === "jwt expired") { | ||
throw new UnauthorizedException("토큰이 만료되었습니다."); | ||
} else if (info.message === "invalid token") { | ||
throw new UnauthorizedException("유효하지 않은 토큰입니다."); | ||
} | ||
throw err || new UnauthorizedException("Unauthorized"); | ||
} | ||
return user; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/test/auth.signin.e2e-spec.ts → BE/test/e2e/auth.signin.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/test/diaries.create.e2e-spec.ts → BE/test/e2e/diaries.create.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/test/diaries.delete.e2e-spec.ts → BE/test/e2e/diaries.delete.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/test/diaries.read-list.e2e-spec.ts → BE/test/e2e/diaries.read-list.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/test/diaries.read.e2e-spec.ts → BE/test/e2e/diaries.read.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.