Skip to content

Commit

Permalink
πŸ› fix edit activity participants reset
Browse files Browse the repository at this point in the history
  • Loading branch information
pbc1017 committed Dec 27, 2023
1 parent 00a1e3b commit f7cccf8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions front/src/pages/EditActivity/EditActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface ActivityState {
location: string;
purpose: string;
content: string;
members: string;
proofText: string;
participants: Participant[];
proofImages: ProofImage[];
Expand All @@ -53,7 +52,6 @@ export const EditActivity = (): JSX.Element => {
location: "",
purpose: "",
content: "",
members: "",
proofText: "",
participants: [],
proofImages: [],
Expand All @@ -66,6 +64,7 @@ export const EditActivity = (): JSX.Element => {
Participant[]
>([]);
const clubId = userStatuses.length > 0 ? userStatuses[0].clubId : null;
const [initialLoad, setInitialLoad] = useState(3);

useEffect(() => {
const fetchActivityData = async () => {
Expand All @@ -88,7 +87,6 @@ export const EditActivity = (): JSX.Element => {
location: data.location,
purpose: data.purpose,
content: data.content,
members: "", // Handle this based on your data structure
proofText: data.proofText,
participants: data.participants,
proofImages: data.proofImages,
Expand Down Expand Up @@ -340,6 +338,12 @@ export const EditActivity = (): JSX.Element => {
};

useEffect(() => {
console.log("useEffect");
if (initialLoad > 0) {
setInitialLoad(initialLoad - 1); // 첫 λ‘œλ”© ν›„μ—λŠ” false둜 μ„€μ •
return; // 첫 λ‘œλ”©μ—μ„œλŠ” λ‚˜λ¨Έμ§€ λ‘œμ§μ„ μ‹€ν–‰ν•˜μ§€ μ•ŠμŒ
}

removeAllParticipants();
activity.participants = [];
searchMember(""); // Call this with an empty string to fetch all members initially
Expand Down

0 comments on commit f7cccf8

Please sign in to comment.