-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] integrate user api for mypage #14
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
Conversation
โฆinto 7-feat-integrate-user-api-for-mypage
| "rules": { | ||
| "prettier/prettier": ["error"], | ||
| "no-unused-vars": "warn", | ||
| "@typescript-eslint/no-unused-vars": "warn" |
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.
์ด๊ฑฐ ๋์ด ๊ฐ์ด ์์ผ๋ฉด ์ถฉ๋๋์ ๊ฒฝ๊ณ ๋ฐ์ค์ด ์ด์ํ๊ฒ ๋จ๋๋ผ๊ณ ์
์ ํฌ ์ด์ฐจํผ typescript๋ง ์ฌ์ฉํ๋๊น ์์๊ฑด ์ง์ ์ต๋๋ค.
devmanta
left a comment
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ํธ์ถํ๋ ๋ถ๋ถ ๊ตฌํํด๋ณด๋๊ฑฐ๋ผ์ ์ค๋ณต๋๋๋ฐ
์๋ก ์ด๋ป๊ฒ ๊ตฌํํ๋์ง ๋ณด๊ณ ๋ณด์ํด์ ํตํฉ์์
์งํํด๋ ์ข์๊ฒ๊ฐ์ต๋๋ค~
+์๊ทธ๋ฆฌ๊ณ ํด๋๊ตฌ์กฐ๋ก router์ค์ ์ด ๋๋ค๋ณด๋ ๋ผ์ฐํ
์ํ๋ ค๊ณ ํ๋ ์ ๋ ์์ private๋๋์ผ๋ก๋ค๊ฐ _ ๋ฃ๋๋ค๊ณ ํ๋๋ผ๊ตฌ์..?
mypageํ์์ ๋ณด๋ฉด components ๋๋ ํ ๋ฆฌ ๋ฑ๋ฑ ์๋๋ฐ ๋ผ์ฐํ
ํ์ํ์ง ์๋์ ๋ค์ _ ๋ถ์ฌ์ ์ฌ์ฉํ๋๊ฑด ์ด๋์?
| } | ||
| }; | ||
|
|
||
| useEffect(() => { |
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.
use client ์ต์์์ ์ ์ธ ์ํด์ค๋ ๋์ํ๋๋ณด๊ตฐ์?
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.
๋ถ๋ชจ์ปดํฌ๋ํธ๊ฐ 'use client' ๋ก ๋์ด์์ผ๋ฉด ํ์ ์๊ธด ํ๋ฐ...
๊ณต์ฉ์ผ๋ก ๋นผ๋ ค๋ฉด ๊ณ ๋ คํด๋ณผ ์ฌํญ์ด๋ค์..!
|
|
||
| export default function FileInput({ name, setValue }: FileInputProps) { | ||
| const [preview, setPreview] = useState(''); | ||
| export default function FileInput({ name, setValue, url, id }: FileInputProps) { |
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.
์๊ธฐ์ name์ ํญ์ 'image' ๋ฌธ์์ด ๊ณ ์ ๊ฐ ๋ง์๊น์?
๊ทธ๋ผ ํ๋ผ๋ฏธํฐ๋ก ์๋ฐ์๋ ๋๋..๋๋์ผ๊น์..?
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.
๋ค image file input ์ฉ๋๋ก๋ง ์ฌ์ฉํ ๊ฑฐ ๊ฐ์์ 'image' ๊ณ ์ ์
๋๋ค.
ํ๋ผ๋ฏธํฐ๋ ์์ด๋ ๋๊ฒ ๋ค์ ๐
| const { login, getMe } = useAuth(); | ||
|
|
||
| const handleLoad = async () => { | ||
| await login(); |
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 ์์ผ๋ฉด loginํ์ด์ง๋ก redirect์ํค๋ middleware์ถ๊ฐํด๋จ๋๋ฐ
์๊ฑฐ ์ฌ์ฉํด๋ด๋ ์ข์๊ฒ๊ฐ์ต๋๋น (๋ค์PR์ ์ฌ๋ฆฌ๋ ค๊ณ ๋๊ธฐ์ค..)
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.
login ๊ด๋ จ ๋ก์ง๋ค์ ์ ๊ฐ ๊ทธ๋ฅ ํ
์คํธํ ๋ ํธํ๊ฒํ๋ ค๊ณ ๋ฃ์๊ฒ๋๋ค..!
์ ์์ ์ธ ๋ก์ง์ด๋ผ๋ฉด ๋ก๊ทธ์ธ ํ ์ ๊ทผ์ด ๊ฐ๋ฅํด์ผ๊ฒ ์ฃ ..!
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.
์ด๋ถ๋ถ์ ์น์ฝ๋ ๋ด๋นํ๋ ๋ถ๋ถ์ธ๊ฒ ๊ฐ์๋ฐ ์น์ฝ๋ ์ด๋ป๊ฒ ๊ตฌ์ํ๊ณ ๊ณ์ ์ง ์์ํด๋ณด๊ณ ๊ณตํต์ ์ฉํด๋ณด์์ฃ ~!
| } | ||
| }; | ||
|
|
||
| const login = async () => { |
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.
์ด๊ฑด ๊ฐ๋ฐ ์์์ฉ์ธ๊ฑธ๊น์?!
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.
์ฌ๊ธฐ์ ํํด์ง๋ ๋ด์ฉ์๋ณด๋ฉด profile์ด๋ ๋น๋ฐ๋ฒํธ ์
๋ฐ์ดํธ ํ๋ apiํธ์ถ์ ํ๋๊ฒ ๊ฐ์๋ฐ
ํ์ผ๋ช
์ด authHelper๋ผ์ ์ฝ๊ฐ ์... ์ข ๋ค๋ฅธ๋๋?์ด ๋ค๊ธดํฉ๋๋ค
auth๋ผ๊ณ ํ๋ฉด ์ธ์ฆ/์ธ๊ฐ ๊ด๋ จ๋ ๋ฌด์ธ๊ฐ ์ผ๊ฒ๊ฐ์๋ฐ ๋ณด๋ฉด์ ์ฌ์ฉ์์ ๋ณด ์
๋ฐ์ดํธ ํ๋ ๋ด์ฉ์ด๋ค์ด์์ด๊ฐ์ง๊ตฌ..
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.
ํ์ผ๋ช ์๋ํด ํ๋ฒ ๋ ์๊ฐํด๋ณด๊ฒ ์ต๋๋ค.. ์ด๋ ต๋ค์ ๐ค
| if (error instanceof 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.
์๋ด์ฉ์ ์์ง ์์ฑ์์ง๊ฑฐ์ฃ ?ใ ใ
| setUser: (user: User | null) => void; | ||
| } | ||
|
|
||
| const useAuthStore = create<AuthState>((set) => ({ |
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.
์ค.. zustand ์ด๋ ๊ฒ๋ง ์ฐ๋ฉด ์ดต์ดต ๋ค๋๋๊ฑด๊ฐ์? ๐
๊ทผ๋ฐ ๊ทธ๋ผ ์๋ context์ฒ๋ผ ์ ์ฉ๋ฒ์๋ฅผ children์ผ๋ก ๏ฟฝ๊ฐ์ธ์ง ์๋๋ฐ
์ ์ฉ๋ฒ์๋ ํญ์ ์ ์ฒด๋ฒ์(?)์ ์ ์ฉ๋๋๊ฑด๊ฐ์?
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.
์ ์ฒด ๋ฒ์๋ ์๋๊ณ
์ ์ฉ ๋ฒ์๋ ์ํ๋ฅผ ์ฌ์ฉํ๋ ์ปดํฌ๋ํธ๋ง ํด๋นํฉ๋๋ค!
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.
์๊ฒ๋ ํตํฉ๋์..!
* โจ feat: integrate user API for mypage * โป๏ธ refactor: improve form component for readability * ๐ฅ comment: remove comment * ๐ฅ remove: remove unnecessary code * โป๏ธ refactor: update FileInput types for flexibility
* โจ feat: integrate user API for mypage * โป๏ธ refactor: improve form component for readability * ๐ฅ comment: remove comment * ๐ฅ remove: remove unnecessary code * โป๏ธ refactor: update FileInput types for flexibility
๐ Related Issue
๐ Description