Skip to content

Commit

Permalink
Revert "feat: getRefreshToken 비동기로 바꾸기"
Browse files Browse the repository at this point in the history
This reverts commit 582a273.
  • Loading branch information
shinwonse committed Sep 4, 2023
1 parent 582a273 commit 8f1ee4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SullogApp.getInitialProps = async (appContext: AppContext) => {
const { ctx } = appContext;
const { req, res, pathname } = ctx;

const refreshToken = await getRefreshToken({ req, res });
const refreshToken = getRefreshToken({ req, res });

console.log('2', req?.headers.cookie, pathname, refreshToken);

Expand All @@ -103,7 +103,7 @@ SullogApp.getInitialProps = async (appContext: AppContext) => {
try {
await refreshAccessToken(ctx);
const accessToken = getAccessToken();
const refreshToken = await getRefreshToken({ req, res });
const refreshToken = getRefreshToken({ req, res });
console.log('5', accessToken, refreshToken);

if (!accessToken || !refreshToken) {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ export const setRefreshToken = (
});
};

export const getRefreshToken = async (context?: {
export const getRefreshToken = (context?: {
req?: IncomingMessage;
res?: ServerResponse;
}) => {
if (isServer() && !context) {
throw new Error("'context' is required for server side cookies");
}

return (await getCookie(REFRESH_TOKEN_KEY, context)) as string | undefined;
return getCookie(REFRESH_TOKEN_KEY, context) as string | undefined;
};

export const deleteRefreshToken = (context?: {
Expand Down

0 comments on commit 8f1ee4e

Please sign in to comment.