Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_URL=https://nudo.cf/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package-lock.json
.env.development.local
.env.test.local
.env.production.local
.env.development

npm-debug.log*
yarn-debug.log*
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down
5 changes: 3 additions & 2 deletions src/components/AllStudy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/components/MyStudy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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); //새로고침
Expand All @@ -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('모집완료 확인');
Expand All @@ -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('삭제 확인');
Expand Down
4 changes: 2 additions & 2 deletions src/components/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion src/components/manage/Attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/components/manage/Penalty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/components/manage/TimeRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import TimeRecordCard from './TimeRecordCard';
import '../../css/TimeRecord.css';

const TimeRecord = (props) => {
axios.defaults.withCredentials = true;

const studyId = props.studyID;

Expand Down
1 change: 1 addition & 0 deletions src/containers/auth/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const LoginForm = ({history}) => {

const onSubmit = e =>{
e.preventDefault();
console.log('Submit');
const { id, password } = form;
dispatch(login({ id, password }));
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/api/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
export const logout = () => client.get('https://nudo-study.cf/api/users/logout');
10 changes: 9 additions & 1 deletion src/lib/api/client.js
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 4 additions & 2 deletions src/pages/LoginFalsePage.js
Original file line number Diff line number Diff line change
@@ -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 (
<Container>
로그인 안했을 때 페이지
로그인 안했을 때 페이지 수정5
</Container>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LoginTruePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Container = styled.div`
const LoginTruePage = () => {
return (
<Container>
로그인했을 때 페이지
로그인했을 때 페이지 수정수정
</Container>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/pages/MyStudyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/StudiesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions src/pages/StudyCreatePage/StudyCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/StudyRankingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 26 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down