From a10e4da095b15068e5dfde4ab96c099d26105cb7 Mon Sep 17 00:00:00 2001 From: mindongmindong <dcmin123@ajou.ac.kr> Date: Fri, 8 Dec 2023 15:59:35 +0900 Subject: [PATCH] [EDIT]error edir --- .gitignore | 1 + react-whenMeet/package.json | 2 +- react-whenMeet/src/components/LinkPageForm.js | 18 ++++++++++-------- .../src/components/MeetingInfoForm.js | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 67554aa..01f8536 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ # Ignore node_modules directory node_modules/ +package.json/ diff --git a/react-whenMeet/package.json b/react-whenMeet/package.json index 4173958..dafb6ea 100644 --- a/react-whenMeet/package.json +++ b/react-whenMeet/package.json @@ -19,7 +19,7 @@ "web-vitals": "^2.1.4" }, "scripts": { - "start": "export PORT=80 && react-scripts start", + "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" diff --git a/react-whenMeet/src/components/LinkPageForm.js b/react-whenMeet/src/components/LinkPageForm.js index 8ee09f3..93fdfb7 100644 --- a/react-whenMeet/src/components/LinkPageForm.js +++ b/react-whenMeet/src/components/LinkPageForm.js @@ -11,14 +11,15 @@ function LinkPageForm() { const {id} = location.state; - const copyToClipboard = async (link) => { - try { - const textToCopy = `localhost:3000/HomeParticipate/${id}`; - await navigator.clipboard.writeText(textToCopy); - alert('클립보드에 복사되었습니다'); - } catch (err) { - alert('클립보드 복사에 실패하였습니다'); - } + const copyToClipboard = () => { + const textToCopy = `localhost:3000/HomeParticipate/${id}`; + const tempInput = document.createElement('input'); + document.body.appendChild(tempInput); + tempInput.value = textToCopy; + tempInput.select(); + document.execCommand('copy'); + document.body.removeChild(tempInput); + alert('클립보드에 복사되었습니다'); }; const handleSubmit = async(event) => { @@ -30,6 +31,7 @@ function LinkPageForm() { return ( <form onSubmit={handleSubmit}> <div> + <p>hey</p> <Input value={`localhost:3000/HomeParticipate/${id}`} /> diff --git a/react-whenMeet/src/components/MeetingInfoForm.js b/react-whenMeet/src/components/MeetingInfoForm.js index e60b435..1f50093 100644 --- a/react-whenMeet/src/components/MeetingInfoForm.js +++ b/react-whenMeet/src/components/MeetingInfoForm.js @@ -31,6 +31,7 @@ function MeetingInfoForm() { setNumber(inputValue); } else { alert("양수만을 입력하세요"); + setNumber(""); } }; -- GitLab