From cf8711b8e669ce3b0c708badd236c7b9f175dd93 Mon Sep 17 00:00:00 2001
From: yuzzznk <69066745+yuzzznk@users.noreply.github.com>
Date: Sat, 9 Jan 2021 02:20:57 +0900
Subject: [PATCH 1/3] Update CardModal.js
---
src/Components/CardModal/CardModal.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/Components/CardModal/CardModal.js b/src/Components/CardModal/CardModal.js
index c585245..6414e67 100644
--- a/src/Components/CardModal/CardModal.js
+++ b/src/Components/CardModal/CardModal.js
@@ -19,7 +19,13 @@ function CardModal({
}) {
const [card, setCard] = useState(undefined);
const [nameState, setNameState] = useState({ name: cardName, edit: false });
- const [refresh, setRefresh] = useState(false);
+
+ //Description 추가 및 변경하기
+ const [description, setDescription] = useState({
+ exist: false,
+ content: undefined,
+ edit: false,
+ });
function getCard() {
apis.card
@@ -54,7 +60,7 @@ function CardModal({
useEffect(() => {
getCard();
- }, [refresh]);
+ }, []);
const exitIfNotModal = (e) => {
if (
@@ -145,6 +151,14 @@ function CardModal({
);
};
+ const activities = useRef();
+
+ const changeDescription = () => {
+ if (description.content === "") setDescription({...description, edit: false});
+ else setDescription({...description, exist: true, edit: false});
+ putCard({cId: card_id, description: description});
+ }
+
return (
Date: Sat, 9 Jan 2021 02:29:52 +0900
Subject: [PATCH 2/3] Update Activity.js
---
src/Components/CardModal/Activity.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/CardModal/Activity.js b/src/Components/CardModal/Activity.js
index dc5f096..a24348f 100644
--- a/src/Components/CardModal/Activity.js
+++ b/src/Components/CardModal/Activity.js
@@ -1,7 +1,7 @@
import React, {useState, useRef} from 'react';
import apis from '../../Library/Apis';
-function Activity({data, refresh, setRefresh, postActivity, putActivity, deleteActivity, detail}) {
+function Activity({data, getCard, postActivity, putActivity, deleteActivity, detail}) {
const inputRef = useRef();
From a175a715a12226e7d71e86c564eb01d17e93d97a Mon Sep 17 00:00:00 2001
From: yuzzznk <69066745+yuzzznk@users.noreply.github.com>
Date: Sat, 9 Jan 2021 02:29:56 +0900
Subject: [PATCH 3/3] Update CardModal.js
---
src/Components/CardModal/CardModal.js | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/Components/CardModal/CardModal.js b/src/Components/CardModal/CardModal.js
index 6414e67..2e4ddd9 100644
--- a/src/Components/CardModal/CardModal.js
+++ b/src/Components/CardModal/CardModal.js
@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from "react";
+import React, { useState, useEffect, useRef } from "react";
import "./CardModal.css";
import Activity from "./Activity.js";
import apis from "../../Library/Apis";
@@ -127,17 +127,6 @@ function CardModal({
setCardName(nameState.name); // 리스트 화면에 보이는 카드 이름 변경
};
- //Description 추가 및 변경하기
- const [description, setDescription] = useState({
- exist: false,
- content: "",
- edit: false,
- });
- useEffect(() => {
- // 서버에 description 변경
- putCard({ cId: card_id, description: description.content });
- }, [description.edit && false]);
-
// 멤버 추가하기
const addMember = () => {
alert(
@@ -362,9 +351,8 @@ function CardModal({
.map((data, index) => (