-
Notifications
You must be signed in to change notification settings - Fork 2
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
Skrf 146 local storage #21
Conversation
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.
์๊ณ ํ์ จ์ต๋๋ค! :)
} | ||
}; | ||
|
||
export { getStorage, setStorage, deleteStorage }; |
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.
์๋ฌ๋ฉ์์ง๋ ๊ฐ๋ฐ์๋ฅผ ์ํ ๋ด์ฉ์
๋๋ค! ์ง๊ธ์ ๋จ์ํ ์๋ฌ๋ฅผ throwํ์ต๋๋ค getStorage๋ฅผ UI๋ ์ด์ด์์ ํธ์ถ์ ์๋ฌ๋ฅผ ์ฒ๋ฆฌํ ์ ์๊ฒ์..!
๊ฑฐ๊ธฐ์๋ ์ฌ์ฉ์๋ฅผ ์ํ ์๋ฌ์ฒ๋ฆฌ๊ฐ ํ์ํ ๊ฒ ๊ฐ๋ค์.. toast๋ฅผ ๋์ด๋ค๋์ง, ์๋ฌ ํ์ด์ง๋ฅผ ๋ณด์ฌ์ค๋ค๋์ง?
์๋๋ฉด ์ปค์คํ
์๋ฌ๋ฅผ ๋ฐ์์์ผ์ ๊ณตํต์ ์ธ ์ฒ๋ฆฌ๋ฅผ ํด์ค์๋ ์์ต๋๋ค!
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.
๊ณ ์ํ์ จ์ต๋๋ค:)
src/utils/localStorage.ts
Outdated
const getStorage = <T>(key: StorageKeys): T => { | ||
try { | ||
const jsonValue = localStorage.getItem(key); | ||
return jsonValue ? JSON.parse(jsonValue) : null; |
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.
p5: setStorage์ getStorage์์ ๊ฐ Value๊ฐ์ ๋ฃ์ด์ค ๋, ๊ฐ value๋ key๊ฐ ์์ผ๋ฉด ์๋์ผ๋ก catch๋ฌธ์ผ๋ก ๊ฐ๋๊น return ๋ฌธ์ ์ผํญ์ฐ์ฐ์๋ก ์์จ๋ ๊ด์ฐฎ์ง์์๊น์ฉ? ์ ๊ฐ ์๋ชป ์๊ณ ์๋ ๊ฒ์ผ ์๋ ์์ด์ ๊ถ๊ธํฉ๋๋ค:)
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.
JSON.parse์ ์ค๋ฅ๋ฅผ ์ก์ผ๋ ค๊ณ ํ๋๋ฐ ์๊ฐํด๋ณด๋ ๊ตฌ์กฐ๊ฐ ์ข ์๋ชป๋๋ค์.. ์์ ํ๊ฒ ์ต๋๋ค!
์ฌ๋ด์ผ๋ก ์ผํญ์ฐ์ฐ์๋ ์คํ ๋ฆฌ์ง์ ๋น๋ฌธ์์ด์ด ์ ์ฅ๋์ด ์์๋ ์ ํจํ๊ฒ ๋ค์!
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.
์์ loacalStorage์ ํค๊ฐ์ด ์์ผ๋ฉด null์ด ๋ฐํ๋๋ค์...! ์ ๋ ์๋ชป์๊ณ ์์์ต๋๋คใ ใ
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 : ์คํ ๋ฆฌ์ง ํค ์์ ์ ์ฅ * feat : ๋ก์ปฌ์คํ ๋ฆฌ์ง ๊ด๋ จ ํจ์ ์ถ๊ฐ * fix : localStorage ์๋ฌ ์ํฉ ๋ณ๊ฒฝ
* design: layout ui ์ ์ฉ * fix: Layout Content margin * SKRF-146 local storage ๊ธฐ๋ฅ ์ถ๊ฐ (#21) * feat : ์คํ ๋ฆฌ์ง ํค ์์ ์ ์ฅ * feat : ๋ก์ปฌ์คํ ๋ฆฌ์ง ๊ด๋ จ ํจ์ ์ถ๊ฐ * fix : localStorage ์๋ฌ ์ํฉ ๋ณ๊ฒฝ * msw ์ด๊ธฐ์ค์ & ์ด๊ธฐ์ค์ ํ์ด์ง api ๊ตฌํ (#23) * chore: msw ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น * feat: ์ด๊ธฐ์ค์ ํ์ด์ง API ๊ตฌํ * style: api res๊ฐ์ฒด ํต์ผ * fix: msw ์๋ฒ ๋ฌธ์ ์ ์ ํด๊ฒฐ * fix: ์ฝ๋๋ฆฌ๋ทฐ ๋ฐ์ * SKRF-139 design banner component (#25) * design: ๋ฐฐ๋ ๊ณตํต ์ปดํฌ๋ํธ ๊ตฌํ * design: ๋ฐฐ๋ ์ปดํฌ๋ํธ ๊ตฌํ * rename: import ํ์ผ ์ด๋ฆ ๋ณ๊ฒฝ * SKRF-142 design: ํค๋ ๋ ์ด์์ ๊ณตํต ์ปดํฌ๋ํธ ๊ตฌํ (#20) * design: ํค๋ ๋ ์ด์์ ๊ณตํต ์ปดํฌ๋ํธ ๊ตฌํ * design: ํค๋ ๋ ์ด์์ ์ค์ ๋ฐ children์ปจํ ์ด๋ ์์ * ์ฝ๋ ์ถฉ๋1 * fix: ์ฝ๋๋ฆฌ๋ทฐ ๋ฐ์1 * fix: ์ฝ๋๋ฆฌ๋ทฐ ๋ฐ์ * fix: App.tsx react-queryclient ์ญ์ --------- Co-authored-by: hyesung99 <[email protected]> Co-authored-by: chaeyeon LEE <[email protected]>
๐์๊ตฌ์ฌํญ๊ณผ ๊ตฌํ๋ด์ฉ
โจprํฌ์ธํธ & ๊ถ๊ธํ ์
getStorage๊ฐ storage๋ฅผ ์ป๋๋ค? ๋ผ๋ ๋๋์ ์ค ์๋ ์์๊ฒ ๊ฐ์์ getFromStorage๊ฐ์ ๋ณ์๋ช ์ผ๋ก ๋ฐ๊ฟ๊น ๊ณ ๋ฏผ์ค์๋ค