diff --git a/src/hooks/useStar.js b/src/hooks/useStar.js
index 47f89836..7d1b0ceb 100644
--- a/src/hooks/useStar.js
+++ b/src/hooks/useStar.js
@@ -6,7 +6,7 @@ import { isLoading } from "@/stores/loading";
export const useMoveonStarP = () => {
const [starP, setStarP] = useState(null);
- const { id } = useParams();
+ let { id } = useParams();
const setLoading = useSetRecoilState(isLoading);
const fetchStarData = async () => {
diff --git a/src/pages/Share/Share.jsx b/src/pages/Share/Share.jsx
index 86e69ac6..f86d94a5 100644
--- a/src/pages/Share/Share.jsx
+++ b/src/pages/Share/Share.jsx
@@ -1,6 +1,7 @@
-import React, { useRef, useState } from "react";
+import React, { useRef, useState, useEffect } from "react";
import html2canvas from "html2canvas";
import { captureScreenshot } from "@/utils/share";
+import { getStarContent } from "@/apis/starP";
import * as S from "./styled";
import shareIcon from "@/assets/shareIcon.svg";
import ClearStarPIcon1 from "@/assets/starclearPicon1.svg";
@@ -8,16 +9,20 @@ import ClearStarPIcon2 from "@/assets/starclearPicon2.svg";
import blur from "@/assets/blur.svg";
import { useParams } from "react-router-dom";
+import { Loading } from "../Loading/Loading";
+
const SharePage = ({ onBack }) => {
const captureRef = useRef();
const [isButtonVisible, setIsButtonVisible] = useState(true);
-
const [starP, setStarP] = useState(null);
- const { id } = useParams();
+ const { starid } = useParams();
+ console.log(starid);
const fetchStarData = async () => {
+ console.log(starid);
try {
- const res = await getStarContent(id);
+ const res = await getStarContent(starid);
+ console.log(res);
setStarP(res);
} catch (error) {
console.error("Error fetching star data:", error);
@@ -25,10 +30,8 @@ const SharePage = ({ onBack }) => {
};
useEffect(() => {
- if (id) {
- fetchStarData();
- }
- }, [id]);
+ fetchStarData();
+ }, []);
const handleCapture = async () => {
setIsButtonVisible(false);
@@ -40,7 +43,9 @@ const SharePage = ({ onBack }) => {
};
const starData = starP && starP.data ? starP.data : null;
-
+ if (!starData) {
+ return