forked from CEOS-Developers/react-vote-18th
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix: token exp 타임이 지나서 cookie를 삭제할 때의 error 해결
이유는 모르겠으나, getSession을 통해 쿠키의 userInfo를 삭제할 때 에러가 발생했다. Cookies can only be modified in a Server Action or Route Handler. 위와 같은 에러가 발생했는데, 일반적인 메소드에서 쿠키를 변경하려 할 때 발생하는 에러인 것 같다. 나는 서버 컴포넌트에서 해당 메소드를 사용하면 문제가 되지 않을 줄 알았는데, 로그인처럼 서버 액션을 따로 만들어서 쿠키를 삭제해주어야 하는 모양이다. 일단 귀찮아서 getSession 내의 쿠키 삭제 로직을 지웠고, middleware를 통해 라우팅시 유효기간이 지난 유저정보를 삭제할 수 있도록 수정했다.
- Loading branch information
Showing
4 changed files
with
17 additions
and
6 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
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