Skip to content

Commit

Permalink
Merge pull request #13 from team-GDGline/feat/camera
Browse files Browse the repository at this point in the history
feat: 무언가 merge함
  • Loading branch information
Catleap02 authored Nov 15, 2024
2 parents aed2b59 + 42e1c24 commit 279ef5c
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/pages/MainPage/components/Aquarium.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import styled from "@emotion/styled";
import { keyframes } from "@emotion/react";
import axios from "axios";
import { API_BASE_URL } from "../../../api/constant";

import background_aquarium from "../../../assets/background_aquarium.svg";
import gardenEel from "../../../assets/pixel/gardenEel.svg";
import napoleonWrasse from "../../../assets/pixel/napoleonWrasse.svg";
Expand All @@ -18,6 +18,8 @@ import clownfish from "../../../assets/pixel/clownfish.svg";
import blackStingray from "../../../assets/pixel/blackStingray.svg";
import leatherbackSeaTurtle from "../../../assets/pixel/leatherbackSeaTurtle.svg";
import humboldtPenguin from "../../../assets/pixel/humboldtPenguin.svg";
import { API_BASE_URL } from "../../../api/constant";


const fishPixel = [
{ src: gardenEel, key: "gardenEel", top: "75%", left: "10%", width: "80px", height: "80px" },
Expand All @@ -42,22 +44,36 @@ 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`,
{ headers: {
Authorization: `Bearer ${accessToken}`, // Bearer 토큰 추가
},
});
const response = await axios.get(`${API_BASE_URL}/api/v1/pokedex`);
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();

fetchFishData();
}, []);

return (
Expand Down

0 comments on commit 279ef5c

Please sign in to comment.