-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth/#62 #66
Auth/#62 #66
Conversation
โฆmented code from user.query.ts
๐storybook: https://65ccb85d5afe55a024495bc0-hjljnwevms.chromatic.com/ |
๐storybook: https://65ccb85d5afe55a024495bc0-abpvtawkuq.chromatic.com/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณ ์ํ์ จ์ต๋๋ค!
// ๊ฐ๋ฐ์ฉ์ด์ฑ์ ์ํด isAuth=true ์ผ ๋๋ง ๋์ | ||
if (isAuth === 'true') { | ||
const auth = await getAuth(request); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํน์ isAuth = true์ ์๋์ ๋ํด ์กฐ๊ธ ๋ ์ค๋ช ํด์ฃผ์ค ์ ์๋์??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ๋ฏธ๋ค์จ์ด์ ์ญํ ์ ํ ํฐ ๊ธฐ๋ฐ ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ์ํํ๊ณ , ๊ฒ์ฌ๊ฐ ํต๊ณผ๋ ๊ฒฝ์ฐ์๋ง ํด๋น ํ์ด์ง์ ์ ๊ทผ์ด ๊ฐ๋ฅํ๊ฒ ํ๋ ๊ฒ์ ๋๋ค.
- ๊ทธ๋ฌ๋ ์ด ๊ฒฝ์ฐ, ์ธ์ฆ์ด ํ์ํ ํ์ด์ง ๊ฐ๋ฐ์ด ๋ถํธํ ์ ์์ผ๋ฏ๋ก, ๊ฐ๋ฐ ๋จ๊ณ์์๋ ํด๋น ์กฐ๊ฑด๋ฌธ์ผ๋ก ๋์ํ์ง ์๋๋ก ์ค์ ํ์์ต๋๋ค.
- ๋ง์ฝ ์ธ์ฆ์ ๋ฐ๋ฅธ ํ์ด์ง ๋ผ์ฐํ ๋์์ด ํ์ํ๋ค๋ฉด, isAuth=true๋ก searchParam์ ์ค์ ํ์๋ฉด ๋ฉ๋๋ค.
}; | ||
} | ||
|
||
const validatedResult = await validateToken(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessToken์ด ์กด์ฌํ๋ฉด validateToken ํจ์๋ฅผ ํธ์ถํ๋ค์!
accessToken์ด ์กด์ฌํ๋ ๊ฒฝ์ฐ๋ง๋ค ์๋ก ํ ํฐ์ ์ฌ๋ฐ๊ธํ์ฌ ์์ฒญ์ ๋ณด๋ด๋ ํ๋ก์ฐ ๊ฐ์๋ฐ, ์ด ์ด์ ๊ฐ ์๋์ฉ??
์ ๋ accessToken์ด ์กด์ฌํ๋ฉด ํด๋น accessToken์ผ๋ก ์์ฒญ์ ๋ณด๋ด๊ณ , error ์๋ต์ ํ ํฐ ์ฌ๋ฐ๊ธ ํ ์ฌ์์ฒญ
์ด ํ๋ก์ฐ๋ฅผ ์๊ฐํ์ด์ ์ฌ์ญค๋ด
๋๋ค!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ๋ง์ํ์ ๋๋ก ์ผ๋ฐ fetch ์์ฒญ์ ๊ฒฝ์ฐ ๊ทธ๋ ๊ฒ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ์ค์ ๋ก, ํด๋ผ์ด์ธํธ ์ฌ์ด๋์์ ์ธ์ฆ์ด ์คํจํ๋ฉด(401 ์๋ฌ ๋ฐ์ ์) ์๋ฌ ๋ฐ์ด๋๋ฆฌ์์ ์ด๋ฅผ ์ฒ๋ฆฌํ๋ ๋ก์ง์ ๋ค์ ์์ ์ผ๋ก ๊ฐ๋ฐํ ๊ณํ์ ๋๋ค.
- ๊ทธ๋ฌ๋ ์ด ๊ฒฝ์ฐ๋ ํ์ด์ง ๋ผ์ฐํ ์ ๋ํ ๊ถํ ์ธ์ฆ์ด๋ฉฐ, ํ์ฌ Next์ API ์๋ฒ๋ฅผ ๋ถ๋ฆฌํ๊ณ ์๋ ์ ํฌ ์ํคํ ์ฒ ๊ตฌ์กฐ์, ํด๋น ํ์ด์ง์ ์ ๊ทผ์ด ๊ฐ๋ฅํ์ง ๊ฒ์ฌํ๊ธฐ ์ํด์๋ ํด๋น ํ ํฐ์ด ์ ํจํ์ง๋ฅผ ๊ฒ์ฌํ ์๋ฐ์ ์์ต๋๋ค.
- ์ด์ ๋ Next ์๋ฒ์ API ์๋ฒ๊ฐ ๋ถ๋ฆฌ๋์ด ์๊ธฐ ๋๋ฌธ์ ๋๋ค. SSR์ ์ํ Next ์๋ฒ์๋ ์ธ์ฆ ์ ๋ณด๊ฐ ์์ผ๋ฏ๋ก, API ์๋ฒ์์ ์ด ์์ฒญ์ด ์ ํจํ์ง ํ์ธํ ํ์ ๋ผ์ฐํ ์ ์ํํ ์ ์์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ต ํ์ธํ์ต๋๋ค!
studentNumber: z.string(), | ||
studentName: z.string(), | ||
major: z.string(), | ||
isSumbitted: z.boolean(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด์ ํ์์ ์ํ๋ฉด isSumbitted
ํด๋น ์ปฌ๋ผ์ ์๋ฒ๋ก๋ถํฐ ์๋ด๋ ค์ค๋ ๊ฒ ์๋๊ฐ์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ํ์ฌ ํด๋น API์ ๋ํ ๋ช ์ธ๊ฐ ์ ํํ๊ฒ ๋์ด ์์ง ์์์ ์ผ๋จ ์์๋ก ์ฒ๋ฆฌํ์์ต๋๋ค.
- ์ถํ ๋ช ์ธ๊ฐ ํ์ ๋๋ฉด ๋ณ๊ฒฝํ๋๋ก ํ๊ฒ ์ต๋๋ค.
๐ ์์ ๋ด์ฉ
๐ค ๊ณ ๋ฏผ ํ๋ ๋ถ๋ถ
๐ ๋์์ด ํ์ํ ๋ถ๋ถ