From 259e9ef4b74286a1784014ae782519c2c12e589e Mon Sep 17 00:00:00 2001 From: aranlll <163715414+aranlll@users.noreply.github.com> Date: Sat, 18 May 2024 21:52:00 +0900 Subject: [PATCH] [feature]/#6/login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 서버에서 데이터 받아오기 하려고 햇으나 ... 실패.... --- client/green__day/package-lock.json | 29 ++++++++++++++++++++++ client/green__day/package.json | 1 + client/green__day/src/App.js | 38 +++++++++-------------------- client/green__day/src/Home.js | 18 ++++++++++---- client/green__day/src/xlog.js | 0 5 files changed, 55 insertions(+), 31 deletions(-) create mode 100644 client/green__day/src/xlog.js diff --git a/client/green__day/package-lock.json b/client/green__day/package-lock.json index b8eb113d..f71b148d 100644 --- a/client/green__day/package-lock.json +++ b/client/green__day/package-lock.json @@ -11,6 +11,7 @@ "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "axios": "^1.6.8", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.23.1", @@ -5398,6 +5399,29 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/axobject-query": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", @@ -14746,6 +14770,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", diff --git a/client/green__day/package.json b/client/green__day/package.json index 02d51e1e..ff1caedc 100644 --- a/client/green__day/package.json +++ b/client/green__day/package.json @@ -6,6 +6,7 @@ "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "axios": "^1.6.8", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.23.1", diff --git a/client/green__day/src/App.js b/client/green__day/src/App.js index e9fb8e08..e6363c9f 100644 --- a/client/green__day/src/App.js +++ b/client/green__day/src/App.js @@ -7,11 +7,12 @@ import Notice from "./Notice.js"; import History from "./History.js"; -import { useState } from "react"; +import { useState ,useEffect} from "react"; function App() { let [buttonOpen,setButtonOpen]=useState(false); + /*let [shouldRenderApp,setShouldRenderApp]=useState(true);*/ const [isModalOpen, setModalOpen] = useState(false);//useState사용하여 상태 초기화 및 모달의 열림/닫힘 상태관리 @@ -40,14 +41,18 @@ function App() { // console.error('데이터를 가져오는 중 오류 발생:', error); // } // } - + /* useEffect(() => { + const path = window.location.pathname; + const excludedPaths = ['/History', '/Notice',"/Home"]; // 제외할 경로들 + setShouldRenderApp(!excludedPaths.includes(path)); + }, []); + + if (!shouldRenderApp) { + return null; + }; + */ return ( <> -

Green Day!

-

Q. 여러분은 평소에 환경을 얼마큼 생각하시나요?
-Green Day는 제로-웨이스트 시도 또는 습관을 기르려는 사람들을 위한 공간입니다.

- 네이버 로그인 -
@@ -61,25 +66,6 @@ Green Day는 제로-웨이스트 시도 또는 습관을 기르려는 사람들
- -
- - - { - buttonOpen == true ?
-
- -
- - -
: null - } - ); } diff --git a/client/green__day/src/Home.js b/client/green__day/src/Home.js index d82e7821..d610725d 100644 --- a/client/green__day/src/Home.js +++ b/client/green__day/src/Home.js @@ -4,7 +4,7 @@ import {Routes, Route,Link, useNavigate} from "react-router-dom"; import Modal from './modiary'; import Notice from "./Notice.js"; import History from "./History.js"; - +import axios from 'axios'; import { useState } from "react"; @@ -12,7 +12,8 @@ import { useState } from "react"; function Home() { let [buttonOpen,setButtonOpen]=useState(false); - + // let [userName,setUserName]=useState(userName); + const [isModalOpen, setModalOpen] = useState(false);//useState사용하여 상태 초기화 및 모달의 열림/닫힘 상태관리 @@ -40,7 +41,7 @@ function Home() { // console.error('데이터를 가져오는 중 오류 발생:', error); // } // } - + return ( <>

Green Day!

@@ -50,7 +51,15 @@ Green Day는 제로-웨이스트 시도 또는 습관을 기르려는 사람들
- 방문자님,
+ +
+ + {/* */} + 님,
환영합니다.

@@ -96,5 +105,4 @@ Green Day는 제로-웨이스트 시도 또는 습관을 기르려는 사람들 } - export default Home; \ No newline at end of file diff --git a/client/green__day/src/xlog.js b/client/green__day/src/xlog.js new file mode 100644 index 00000000..e69de29b