From aff3d7fdf2ffd17b5ace14753154fef6bc9c4878 Mon Sep 17 00:00:00 2001 From: juha399 Date: Mon, 10 Feb 2025 15:45:14 +0900 Subject: [PATCH] fix: rename --- src/pages/myPage/MyPage.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/myPage/MyPage.jsx b/src/pages/myPage/MyPage.jsx index ce8bc8f..6443091 100644 --- a/src/pages/myPage/MyPage.jsx +++ b/src/pages/myPage/MyPage.jsx @@ -7,7 +7,7 @@ import { fetchIdols } from '@/apis/myPageApi.js'; import PrimaryButton from '@/components/PrimaryButton'; import xButton from '@/assets/icons/xButton.svg'; -const storageKey = 'favoriteIdols'; +const STORAGEKEY = 'favoriteIdols'; const MyPage = () => { const [idols, setIdols] = useState([]); @@ -39,7 +39,7 @@ const MyPage = () => { }, []); useEffect(() => { - const storedFavorites = localStorage.getItem(storageKey); + const storedFavorites = localStorage.getItem(STORAGEKEY); if (storedFavorites) { setFavoriteIdols(storedFavorites.split(',').map(Number)); } @@ -58,7 +58,7 @@ const MyPage = () => { if (selectedIdols.length === 0) return; setFavoriteIdols((prev) => { const updatedFavorites = [...new Set([...prev, ...selectedIdols])]; - localStorage.setItem(storageKey, updatedFavorites.join(',')); + localStorage.setItem(STORAGEKEY, updatedFavorites.join(',')); return updatedFavorites; }); setSelectedIdols([]); @@ -67,7 +67,7 @@ const MyPage = () => { const handleRemoveFavorite = (idolId) => { setFavoriteIdols((prev) => { const updatedFavorites = prev.filter((id) => id !== idolId); - localStorage.setItem(storageKey, updatedFavorites.join(',')); + localStorage.setItem(STORAGEKEY, updatedFavorites.join(',')); return updatedFavorites; }); };