diff --git a/.env b/.env
new file mode 100644
index 0000000..487b0d7
--- /dev/null
+++ b/.env
@@ -0,0 +1 @@
+REACT_APP_API_URL=https://nudo.cf/
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index ada77a5..3c4dc22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ package-lock.json
.env.development.local
.env.test.local
.env.production.local
+.env.development
npm-debug.log*
yarn-debug.log*
diff --git a/package.json b/package.json
index 76d41ed..4786aa2 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "nd-front",
"version": "0.1.0",
"private": true,
- "proxy": "https://172.30.1.50:8000",
+ "proxy": "https://nudo-study.cf/",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
@@ -15,6 +15,7 @@
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
+ "aws": "^0.0.3-2",
"axios": "^0.25.0",
"bootstrap": "^5.1.3",
"cors": "^2.8.5",
@@ -45,6 +46,9 @@
"scripts": {
"start": "cross-env HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem react-scripts start",
"build": "react-scripts build",
+ "client-s3-deploy": "aws s3 sync build/ s3://www.neodu-studydo.tk",
+ "cloudfront-invalidation": "aws cloudfront create-invalidation --distribution-id E2B7BIXVNV8A8L --paths '/*'",
+ "deploy": "npm run build && npm run client-s3-deploy",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
diff --git a/src/components/AllStudy.js b/src/components/AllStudy.js
index c91758b..ad56dbe 100644
--- a/src/components/AllStudy.js
+++ b/src/components/AllStudy.js
@@ -4,9 +4,10 @@ import axios from 'axios';
import {Card,Button} from 'react-bootstrap';
const StudiesComp = (props) => {
+ axios.defaults.withCredentials = true;
const study = props.study;
- const URL = '/api/studies/join';
+ const URL = 'https://nudo-study.cf/api/studies/join';
const [join, setJoin] = useState(null);
// const [click, setClick] = useState(false);
@@ -19,7 +20,7 @@ const StudiesComp = (props) => {
// setError(null);
// setJoin(null);
// setLoading(true);
-
+ console.log('process:',process.env);
const response = await axios.post(URL,{study_id: study.id});
// const response = await axios.post(URL,{study_id:'asd'});
// setJoin(response);
diff --git a/src/components/MyStudy.js b/src/components/MyStudy.js
index 3bf991f..2ab63db 100644
--- a/src/components/MyStudy.js
+++ b/src/components/MyStudy.js
@@ -8,13 +8,13 @@ const MyStudy = (props) => {
const mystudy = props.mystudy;
const mystudy_id = mystudy.id;
- const URL_room = '/api/studies/do/'+mystudy_id;
- const URL_recruit = '/api/studies/completed/'+mystudy_id;
- const URL_delete = '/api/studies/setting/'+mystudy_id;
+ const URL_room = 'https://nudo-study.cf/api/studies/do/'+mystudy_id;
+ const URL_recruit = 'https://nudo-study.cf/api/studies/completed/'+mystudy_id;
+ const URL_delete = 'https://nudo-study.cf/api/studies/setting/'+mystudy_id;
const fetchRoom = async () => {
try{
- const response = await axios.get(URL_room);
+ const response = await axios.get(URL_room,{ withCredentials: true });
console.log(response.data);
if(response.data.code==="200"){
window.location.assign('/room/'+response.data.addr); //새로고침
@@ -34,7 +34,7 @@ const MyStudy = (props) => {
const recruited = async () => {
console.log('모집완료');
try{
- const response = await axios.get(URL_recruit);
+ const response = await axios.get(URL_recruit,{ withCredentials: true });
console.log(response.data);
if(response.data.code==="200"){
console.log('모집완료 확인');
@@ -48,7 +48,7 @@ const MyStudy = (props) => {
const deleteStudy = async () => {
console.log('스터디 삭제');
try{
- const response = await axios.delete(URL_delete);
+ const response = await axios.delete(URL_delete,{ withCredentials: true });
console.log(response.data);
if(response.data.code === 200 ){
console.log('삭제 확인');
diff --git a/src/components/Room.js b/src/components/Room.js
index 5b0a606..f2b6a7f 100644
--- a/src/components/Room.js
+++ b/src/components/Room.js
@@ -90,7 +90,7 @@ const Room = (props) => {
useEffect(() => { //렌더링 될 때마다 실행, peers 값 변할 때마다 렌더링
console.log("렌더링3: useEffect 실행 -> 소켓 통신, 디텍션 ");
console.log("렌더링3: videolistRef.current[0] : ", videolistRef.current[0]);
- socketRef.current = io.connect("https://10.200.150.87:8000"); //현재 커넥트 정보 저장
+ socketRef.current = io.connect("https://nudo-study.cf/"); //현재 커넥트 정보 저장
console.log(socketRef.current)
navigator.mediaDevices.getUserMedia({ video: videoConstraints, audio: false })
@@ -207,7 +207,7 @@ const Room = (props) => {
const formData = new FormData();
formData.append('image', imageRef.current);
- const response = await fetch('https://10.200.150.87:5000/image', {
+ const response = await fetch('https://192.168.35.143:5000/image', {
method: "POST",
body: formData,
}).then().catch(err => console.log(err));
diff --git a/src/components/manage/Attendance.js b/src/components/manage/Attendance.js
index 75e89dc..875a544 100644
--- a/src/components/manage/Attendance.js
+++ b/src/components/manage/Attendance.js
@@ -7,7 +7,8 @@ import { FaRegSquare } from "react-icons/fa";
import { FaRegWindowMinimize } from "react-icons/fa";
const Attendance = (props) => {
-
+ axios.defaults.withCredentials = true;
+
var fix_today = new Date();
var fix_month = fix_today.getMonth()+1;
var fix_date = fix_today.getDate();
diff --git a/src/components/manage/Penalty.js b/src/components/manage/Penalty.js
index af3d3fb..442a42e 100644
--- a/src/components/manage/Penalty.js
+++ b/src/components/manage/Penalty.js
@@ -7,6 +7,7 @@ const Container = styled.div`
padding: 20px;
`;
const Penalty = (props) => {
+ axios.defaults.withCredentials = true;
const studyID = props.studyID;
const URL ='/api/studies/penalty/'+studyID;
const [penalty, setPenalty] = useState(null);
diff --git a/src/components/manage/TimeRecord.js b/src/components/manage/TimeRecord.js
index 9cfc820..0c31192 100644
--- a/src/components/manage/TimeRecord.js
+++ b/src/components/manage/TimeRecord.js
@@ -6,6 +6,7 @@ import TimeRecordCard from './TimeRecordCard';
import '../../css/TimeRecord.css';
const TimeRecord = (props) => {
+ axios.defaults.withCredentials = true;
const studyId = props.studyID;
diff --git a/src/containers/auth/LoginForm.js b/src/containers/auth/LoginForm.js
index 3c2c8f3..7f1baff 100644
--- a/src/containers/auth/LoginForm.js
+++ b/src/containers/auth/LoginForm.js
@@ -30,6 +30,7 @@ const LoginForm = ({history}) => {
const onSubmit = e =>{
e.preventDefault();
+ console.log('Submit');
const { id, password } = form;
dispatch(login({ id, password }));
}
diff --git a/src/lib/api/auth.js b/src/lib/api/auth.js
index 25f6ed3..17e268a 100644
--- a/src/lib/api/auth.js
+++ b/src/lib/api/auth.js
@@ -2,14 +2,14 @@ import client from "./client";
/* login */
export const login = ({id,password}) =>
- client.post('/api/users/login',{id,password});
+ client.post('https://nudo-study.cf/api/users/login',{id,password});
/* register */
export const register = ({id,password})=>
- client.post('/api/users/',{id,password});
+ client.post('https://nudo-study.cf/api/users/',{id,password});
/* 로그인 상태 확인 */
-export const check = () => client.get('/api/users/check');
+export const check = () => client.get('https://nudo-study.cf/api/users/check');
/* logout */
-export const logout = () => client.get('/api/users/logout');
\ No newline at end of file
+export const logout = () => client.get('https://nudo-study.cf/api/users/logout');
\ No newline at end of file
diff --git a/src/lib/api/client.js b/src/lib/api/client.js
index 3b87420..48e4fec 100644
--- a/src/lib/api/client.js
+++ b/src/lib/api/client.js
@@ -1,5 +1,13 @@
import axios from 'axios';
-const client = axios.create();
+// const client = axios.create({
+// withCredentials: true
+// });
+
+// const client = axios.create();
+
+const client = axios.create({
+ withCredentials: true
+})
export default client;
\ No newline at end of file
diff --git a/src/pages/LoginFalsePage.js b/src/pages/LoginFalsePage.js
index 95f37cb..0674154 100644
--- a/src/pages/LoginFalsePage.js
+++ b/src/pages/LoginFalsePage.js
@@ -1,14 +1,16 @@
-import React from 'react';
+import React , { useEffect, useState } from 'react';
import styled from 'styled-components';
+import axios from 'axios';
const Container = styled.div`
padding: 20px;
`;
const LoginFalsePage = () => {
+
return (
- 로그인 안했을 때 페이지
+ 로그인 안했을 때 페이지 수정5
);
};
diff --git a/src/pages/LoginTruePage.js b/src/pages/LoginTruePage.js
index 0c2ed70..fdc4bdf 100644
--- a/src/pages/LoginTruePage.js
+++ b/src/pages/LoginTruePage.js
@@ -7,7 +7,7 @@ const Container = styled.div`
const LoginTruePage = () => {
return (
- 로그인했을 때 페이지
+ 로그인했을 때 페이지 수정수정
);
};
diff --git a/src/pages/MyStudyPage.js b/src/pages/MyStudyPage.js
index 3b8c06f..80f54cd 100644
--- a/src/pages/MyStudyPage.js
+++ b/src/pages/MyStudyPage.js
@@ -9,7 +9,7 @@ const Container = styled.div`
`;
const MyStudyPage = () => {
- const URL = '/api/users/studies';
+ const URL = 'https://nudo-study.cf/api/users/studies';
const [myStudy, setMyStudy] = useState(null);
const [loading, setLoading] = useState(false);
@@ -21,7 +21,7 @@ const MyStudyPage = () => {
setMyStudy(null);
setLoading(true);
- const response = await axios.get(URL);
+ const response = await axios.get(URL,{ withCredentials: true });
setMyStudy(response.data);
}catch(e){
setError(e);
diff --git a/src/pages/StudiesPage.js b/src/pages/StudiesPage.js
index 309d4fe..7809c1f 100644
--- a/src/pages/StudiesPage.js
+++ b/src/pages/StudiesPage.js
@@ -9,7 +9,7 @@ const Container = styled.div`
`;
const StudiesPage = () => {
- const URL = '/api/studies';
+ const URL = 'https://nudo-study.cf/api/studies';
const [studies, setStudies] = useState(null);
const [loading, setLoading] = useState(false);
diff --git a/src/pages/StudyCreatePage/StudyCreate.js b/src/pages/StudyCreatePage/StudyCreate.js
index 1079306..7ce8637 100644
--- a/src/pages/StudyCreatePage/StudyCreate.js
+++ b/src/pages/StudyCreatePage/StudyCreate.js
@@ -43,18 +43,21 @@ const Input = styled.input`
// `;
const StudyCreate = (props) => {
- const URL = '/api/studies';
+ axios.defaults.withCredentials = true;
+
+ const URL = 'https://nudo-study.cf/api/studies';
const {inputs,submitting,handleChange,handleSubmit} = useForm({
initialValues: {study_id: "",title:"",topic:"",target_time:"",penalty:"",info:""},
onSubmit: (inputs) => {
// alert(JSON.stringify(inputs,null,2));
-
+ console.log('inpusts:',inputs);
const fetchData = async()=>{
try{
// const response = await axios.post(URL,JSON.stringify(inputs));
const response = await axios.post(URL,inputs);
console.log(response.data.result);
+ console.log(response.data);
if(response.data.code === "200"){
console.log('study_id:',inputs.study_id);
// sessionStorage.setItem('user',inputs.id);
diff --git a/src/pages/StudyRankingPage.js b/src/pages/StudyRankingPage.js
index 89a8cf3..fcf1fcd 100644
--- a/src/pages/StudyRankingPage.js
+++ b/src/pages/StudyRankingPage.js
@@ -45,7 +45,8 @@ const Content3 = styled.div`
`;
const StudyRankingPage = () => {
- const URL = '/api/rankings/studies';
+ axios.defaults.withCredentials = true;
+ const URL = 'https://nudo-study.cf/api/rankings/studies';
const [studies, setStudies] = useState(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
diff --git a/yarn.lock b/yarn.lock
index 5d750ac..b2db3a8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2645,6 +2645,13 @@
"picocolors" "^1.0.0"
"postcss-value-parser" "^4.2.0"
+"aws@^0.0.3-2":
+ "integrity" "sha1-jEwXDEc2SzCf3+Sw/kwXEESD+kY="
+ "resolved" "https://registry.npmjs.org/aws/-/aws-0.0.3-2.tgz"
+ "version" "0.0.3-2"
+ dependencies:
+ "vows" ">= 0.5.1"
+
"axe-core@^4.3.5":
"integrity" "sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA=="
"resolved" "https://registry.npmjs.org/axe-core/-/axe-core-4.3.5.tgz"
@@ -3828,6 +3835,11 @@
"resolved" "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz"
"version" "27.4.0"
+"diff@^4.0.1":
+ "integrity" "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
+ "resolved" "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz"
+ "version" "4.0.2"
+
"dir-glob@^3.0.1":
"integrity" "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA=="
"resolved" "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz"
@@ -4495,6 +4507,11 @@
"utils-merge" "1.0.1"
"vary" "~1.1.2"
+"eyes@~0.1.6":
+ "integrity" "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A="
+ "resolved" "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
+ "version" "0.1.8"
+
"fast-deep-equal@^3.1.1", "fast-deep-equal@^3.1.3":
"integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
"resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"
@@ -9235,6 +9252,15 @@
"resolved" "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
"version" "1.1.2"
+"vows@>= 0.5.1":
+ "integrity" "sha512-PVIxa/ovXhrw5gA3mz6M+ZF3PHlqX4tutR2p/y9NWPAaFVKcWBE8b2ktfr0opQM/qFmcOVWKjSCJVjnYOvjXhw=="
+ "resolved" "https://registry.npmjs.org/vows/-/vows-0.8.3.tgz"
+ "version" "0.8.3"
+ dependencies:
+ "diff" "^4.0.1"
+ "eyes" "~0.1.6"
+ "glob" "^7.1.2"
+
"w3c-hr-time@^1.0.2":
"integrity" "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ=="
"resolved" "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz"