Skip to content

Commit

Permalink
feat: 아쿠아리움 인가 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Catleap02 committed Nov 15, 2024
1 parent c580437 commit 7c2c1b5
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions src/pages/MainPage/components/Aquarium.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,28 @@ interface AquariumProps {

const Aquarium: React.FC<AquariumProps> = ({ children }) => {
const [fishData, setFishData] = useState<Record<string, boolean>>({});

const accessToken = localStorage.getItem("accessToken");
useEffect(() => {
const fetchFishData = async () => {
try {
const response = await axios.get(`${API_BASE_URL}/api/v1/pokedex`);
const response = await axios.get(
`${API_BASE_URL}/api/v1/pokedex`,
{
headers: {
Authorization: `Bearer ${accessToken}`, // 인증 토큰 추가
"Content-Type": "application/json",
},
}
);
setFishData(response.data); // 물고기 데이터 저장
// setFishData(
// {
// "gardenEel": true,
// "napoleonWrasse": false,
// "arowana": true,
// "blacktipReefShark": false,
// "africanManatee": true,
// "giantGrouper": false,
// "smallClawedOtter": true,
// "piranha": false,
// "zebraShark": true,
// "californiaSeaLion": true,
// "clownfish": false,
// "blackStingray": true,
// "leatherbackSeaTurtle": false,
// "humboldtPenguin": true
// }
// )
} catch (error) {
console.error("물고기 데이터를 가져오는 중 오류가 발생했습니다:", error);
}
};

fetchFishData();
}, []);


return (
<AquariumWrapper>
Expand Down

0 comments on commit 7c2c1b5

Please sign in to comment.