Skip to content

Commit

Permalink
Merge branch 'dev' into feature/LikeLion-at-DGU#349
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaem03 authored Aug 6, 2024
2 parents 9ed585d + cf407fc commit 20abe34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useStar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
23 changes: 14 additions & 9 deletions src/pages/Share/Share.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
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";
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);
}
};

useEffect(() => {
if (id) {
fetchStarData();
}
}, [id]);
fetchStarData();
}, []);

const handleCapture = async () => {
setIsButtonVisible(false);
Expand All @@ -40,7 +43,9 @@ const SharePage = ({ onBack }) => {
};

const starData = starP && starP.data ? starP.data : null;

if (!starData) {
return <Loading />;
}
return (
<div
style={{
Expand Down

0 comments on commit 20abe34

Please sign in to comment.