From 46bc0881f7c5b12d0d74ed8bd6be90b755b1aad0 Mon Sep 17 00:00:00 2001 From: jeasong Date: Fri, 7 May 2021 03:10:23 +0900 Subject: [PATCH 1/5] upload --- src/App.js | 8 ++++---- src/GamePages/InGame.js | 2 +- src/GamePages/components/Canvas.js | 2 +- src/MainPages/components/Signin.js | 2 +- src/MainPages/components/Signup.js | 2 +- src/MainPages/main.js | 2 +- src/MyPages/MyPage.js | 4 ++-- src/WaitingPages/components/CreateGame.js | 2 +- src/WaitingPages/components/EntryGame.js | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/App.js b/src/App.js index 3d3025d..4356517 100644 --- a/src/App.js +++ b/src/App.js @@ -48,7 +48,7 @@ export default function App() { axios .get( - 'http://localhost:4000/user/logout', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/user/logout', {withCredentials: true} ).then((res) => {}) setUserInfo({ @@ -67,7 +67,7 @@ export default function App() { const accessTokenRequest = (accessToken) => { // ! 유저 정보를 알려달라는 코드 axios - .get('http://localhost:4000/accessTokenHandler', { + .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/accessTokenHandler', { headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', @@ -92,7 +92,7 @@ export default function App() { const refreshTokenRequest = () => { // ! 일정 주기로 함수 계속 보냄 axios - .get('http://localhost:4000/refreshTokenHandler', { + .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/refreshTokenHandler', { withCredentials: true, }) .then((res) => { @@ -122,7 +122,7 @@ export default function App() { const getAccessToken = async (authorizationCode) => { // ! 구글 로그인 let resp = await axios.post( - 'http://localhost:4000/googlelogin', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/googlelogin', { authorizationCode: authorizationCode, }, diff --git a/src/GamePages/InGame.js b/src/GamePages/InGame.js index 6ccefe0..813ee93 100644 --- a/src/GamePages/InGame.js +++ b/src/GamePages/InGame.js @@ -11,7 +11,7 @@ import Words from '../Words'; import { useHistory } from 'react-router-dom'; import Logo from './components/Logo'; import Canvas from './components/Canvas3'; -const socket = io.connect('http://localhost:4000', { +const socket = io.connect('ec2-3-139-101-167.us-east-2.compute.amazonaws.com', { transports: ['websocket'], path: '/socket.io', }); diff --git a/src/GamePages/components/Canvas.js b/src/GamePages/components/Canvas.js index 9135c65..96e262a 100644 --- a/src/GamePages/components/Canvas.js +++ b/src/GamePages/components/Canvas.js @@ -151,7 +151,7 @@ export default function Canvas() { drawLine(data.x0 * w, data.y0 * h, data.x1 * w, data.y1 * h, data.color); }; - socketRef.current = io.connect('http://localhost:4000', { + socketRef.current = io.connect('ec2-3-139-101-167.us-east-2.compute.amazonaws.com', { transports: ['websocket', 'polling'], path: '/socket.io', }); diff --git a/src/MainPages/components/Signin.js b/src/MainPages/components/Signin.js index 0ebd9a8..1f69d5b 100644 --- a/src/MainPages/components/Signin.js +++ b/src/MainPages/components/Signin.js @@ -24,7 +24,7 @@ export default function Signin({ isOpen, close, loginHandler }) { if (e.key === 'Enter' || e.type === 'click') { axios .post( - 'http://localhost:4000/login', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/login', { email, password }, { headers: { 'Content-Type': 'application/json' }, diff --git a/src/MainPages/components/Signup.js b/src/MainPages/components/Signup.js index a64facf..f4bbd8c 100644 --- a/src/MainPages/components/Signup.js +++ b/src/MainPages/components/Signup.js @@ -26,7 +26,7 @@ export default function Signup({ isOpen, close, idCreatedOk }) { if (e.key === 'Enter' || e.type === 'click') { try { const data = await axios.post( - 'http://localhost:4000/signup', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/signup', { email, password, nickname }, { headers: { 'Content-Type': 'application/json' }, diff --git a/src/MainPages/main.js b/src/MainPages/main.js index f0ef645..e016448 100644 --- a/src/MainPages/main.js +++ b/src/MainPages/main.js @@ -23,7 +23,7 @@ export default function Main({ loginHandler, handleGuestLogin }) { const guestLogIn = () => { axios - .get('http://localhost:4000/guest', + .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/guest', { withCredentials: true }) diff --git a/src/MyPages/MyPage.js b/src/MyPages/MyPage.js index af2503e..798d3b4 100644 --- a/src/MyPages/MyPage.js +++ b/src/MyPages/MyPage.js @@ -61,7 +61,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) { const MyPageSaveData= async (PhotoNum) =>{ await refreshTokenRequest() - const SavePhoto = await axios.post(`http://localhost:4000/mypage/${id}/profile`, + const SavePhoto = await axios.post(`ec2-3-139-101-167.us-east-2.compute.amazonaws.com/mypage/${id}/profile`, {new_profile: PhotoNum}, { headers: { @@ -70,7 +70,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) { }, //withCredentials: true, }) - const SaveComment = await axios.post(`http://localhost:4000/mypage/${id}/comment`, + const SaveComment = await axios.post(`ec2-3-139-101-167.us-east-2.compute.amazonaws.com/mypage/${id}/comment`, {Comment: '아니라어민어리ㅏㅁㄴ얼'}, { headers: { diff --git a/src/WaitingPages/components/CreateGame.js b/src/WaitingPages/components/CreateGame.js index d4114fd..0c301dd 100644 --- a/src/WaitingPages/components/CreateGame.js +++ b/src/WaitingPages/components/CreateGame.js @@ -22,7 +22,7 @@ export default function CreateGame({ createModal, closeModal,accessToken }) { await axios .post( - 'http://localhost:4000/room/new', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/room/new', { room_name, room_pw }, { headers: { diff --git a/src/WaitingPages/components/EntryGame.js b/src/WaitingPages/components/EntryGame.js index ebb0edf..658adf4 100644 --- a/src/WaitingPages/components/EntryGame.js +++ b/src/WaitingPages/components/EntryGame.js @@ -7,7 +7,7 @@ function EntryGame({ accessToken }) { const handleUrl = async () => { const result = await axios.post( - 'http://localhost:4000/room/join', + 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/room/join', {}, { headers: { From 6d9fec6b16ef31a558c8664ee78ff1f0feef47ca Mon Sep 17 00:00:00 2001 From: jeasong Date: Fri, 7 May 2021 03:12:41 +0900 Subject: [PATCH 2/5] upload --- src/MainPages/components/SocialLogin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MainPages/components/SocialLogin.js b/src/MainPages/components/SocialLogin.js index 1180437..d3941b8 100644 --- a/src/MainPages/components/SocialLogin.js +++ b/src/MainPages/components/SocialLogin.js @@ -2,7 +2,7 @@ import React from 'react'; export default function SocialLogin() { const socialLoginHandler = () => { - const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=http://localhost:3000&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; + const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=http://http://mindcaptor.s3-website.ap-northeast-2.amazonaws.com&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; window.location.assign(url); }; From cb26c7b9d2f1367f8b6c128529d54c2f4105fb67 Mon Sep 17 00:00:00 2001 From: jeasong Date: Fri, 7 May 2021 04:26:23 +0900 Subject: [PATCH 3/5] upload --- .env | 1 + package-lock.json | 1 + package.json | 1 + src/App.js | 11 ++++++----- src/GamePages/InGame.js | 3 ++- src/GamePages/components/Canvas.js | 4 ++-- src/GamePages/components/Canvas3.js | 3 ++- src/MainPages/components/Signin.js | 3 ++- src/MainPages/components/Signup.js | 4 ++-- src/MainPages/components/SocialLogin.js | 2 +- src/MainPages/main.js | 3 ++- src/MyPages/MyPage.js | 5 +++-- 12 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..287a055 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SERVER=http://ec2-3-139-101-167.us-east-2.compute.amazonaws.com:80 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 494b8bd..10f7baa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@testing-library/user-event": "^12.8.3", "axios": "^0.21.1", "bootstrap": "^4.6.0", + "dotenv": "^8.2.0", "moment": "^2.29.1", "react": "^17.0.2", "react-bootstrap": "^1.5.2", diff --git a/package.json b/package.json index 5d47c0a..c8036ef 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@testing-library/user-event": "^12.8.3", "axios": "^0.21.1", "bootstrap": "^4.6.0", + "dotenv": "^8.2.0", "moment": "^2.29.1", "react": "^17.0.2", "react-bootstrap": "^1.5.2", diff --git a/src/App.js b/src/App.js index fe74bc0..c8c63b5 100644 --- a/src/App.js +++ b/src/App.js @@ -8,6 +8,7 @@ import Character1 from './images/Character1.png'; import { useHistory } from 'react-router-dom'; import './main.css'; import Bgm from './Bgm'; +require('dotenv').config(); const axios = require('axios'); @@ -48,7 +49,7 @@ export default function App() { axios .get( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/user/logout', + `${process.env.SERVER}/user/logout`, {withCredentials: true} ).then((res) => {}) setUserInfo({ @@ -67,7 +68,7 @@ export default function App() { const accessTokenRequest = (accessToken) => { // ! 유저 정보를 알려달라는 코드 axios - .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/accessTokenHandler', { + .get(`${process.env.SERVER}/accessTokenHandler`, { headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', @@ -88,9 +89,9 @@ export default function App() { }; const refreshTokenRequest = () => { - // ! 일정 주기로 함수 계속 보냄 + // ! 일정 주기로 함수 계속 보냄http://ec2-3-139-101-167.us-east-2.compute.amazonaws.com:80 axios - .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/refreshTokenHandler', { + .get(`${process.env.SERVER}/refreshTokenHandler`, { withCredentials: true, }) .then((res) => { @@ -121,7 +122,7 @@ export default function App() { const getAccessToken = async (authorizationCode) => { // ! 구글 로그인 let resp = await axios.post( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/googlelogin', + `${process.env.SERVER}/googlelogin`, { authorizationCode: authorizationCode, }, diff --git a/src/GamePages/InGame.js b/src/GamePages/InGame.js index bfd1c21..19898bc 100644 --- a/src/GamePages/InGame.js +++ b/src/GamePages/InGame.js @@ -11,7 +11,8 @@ import Words from '../Words'; import { useHistory } from 'react-router-dom'; import Logo from './components/Logo'; import Canvas from './components/Canvas3'; -const socket = io.connect('ec2-3-139-101-167.us-east-2.compute.amazonaws.com', { +require('dotenv').config(); +const socket = io.connect(`${process.env.SERVER}`, { transports: ['websocket'], path: '/socket.io', }); diff --git a/src/GamePages/components/Canvas.js b/src/GamePages/components/Canvas.js index 96e262a..9827ad2 100644 --- a/src/GamePages/components/Canvas.js +++ b/src/GamePages/components/Canvas.js @@ -1,7 +1,7 @@ import React, { useRef, useEffect } from 'react'; import io from 'socket.io-client'; // import './styles/board.css'; - +require('dotenv').config(); export default function Canvas() { const canvasRef = useRef(null); const colorsRef = useRef(null); @@ -151,7 +151,7 @@ export default function Canvas() { drawLine(data.x0 * w, data.y0 * h, data.x1 * w, data.y1 * h, data.color); }; - socketRef.current = io.connect('ec2-3-139-101-167.us-east-2.compute.amazonaws.com', { + socketRef.current = io.connect(`${process.env.SERVER}`, { transports: ['websocket', 'polling'], path: '/socket.io', }); diff --git a/src/GamePages/components/Canvas3.js b/src/GamePages/components/Canvas3.js index f19bda8..3bd66ce 100644 --- a/src/GamePages/components/Canvas3.js +++ b/src/GamePages/components/Canvas3.js @@ -8,6 +8,7 @@ import Crayon_Blue from '../../images/crayon_blue.png'; import Crayon_Green from '../../images/crayon_green.png'; import Crayon_Yellow from '../../images/crayon_yellow.png'; import io from 'socket.io-client'; +require('dotenv').config(); export default function Canvas3() { const canvasRef = useRef(null); @@ -121,7 +122,7 @@ export default function Canvas3() { drawLine(data.x0 * w, data.y0 * h, data.x1 * w, data.y1 * h, data.color); }; - socketRef.current = io.connect('http://localhost:4000', { + socketRef.current = io.connect(`${process.env.SERVER}`, { transports: ['websocket', 'polling'], path: '/socket.io', }); diff --git a/src/MainPages/components/Signin.js b/src/MainPages/components/Signin.js index 1f69d5b..0675ca9 100644 --- a/src/MainPages/components/Signin.js +++ b/src/MainPages/components/Signin.js @@ -3,6 +3,7 @@ import '../../main.css'; import logo from '../../images/mindcaptor_logo_login.png'; import { useHistory } from 'react-router-dom'; import SocialLogin from './SocialLogin'; +require('dotenv').config(); const axios = require('axios'); @@ -24,7 +25,7 @@ export default function Signin({ isOpen, close, loginHandler }) { if (e.key === 'Enter' || e.type === 'click') { axios .post( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/login', + `${process.env.SERVER}/login`, { email, password }, { headers: { 'Content-Type': 'application/json' }, diff --git a/src/MainPages/components/Signup.js b/src/MainPages/components/Signup.js index f4bbd8c..5531107 100644 --- a/src/MainPages/components/Signup.js +++ b/src/MainPages/components/Signup.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import '../../main.css'; import logo from '../../images/mindcaptor_logo_sign.png'; const axios = require('axios'); - +require('dotenv').config(); export default function Signup({ isOpen, close, idCreatedOk }) { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); @@ -26,7 +26,7 @@ export default function Signup({ isOpen, close, idCreatedOk }) { if (e.key === 'Enter' || e.type === 'click') { try { const data = await axios.post( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/signup', + `${process.env.SERVER}`, { email, password, nickname }, { headers: { 'Content-Type': 'application/json' }, diff --git a/src/MainPages/components/SocialLogin.js b/src/MainPages/components/SocialLogin.js index d3941b8..d654f47 100644 --- a/src/MainPages/components/SocialLogin.js +++ b/src/MainPages/components/SocialLogin.js @@ -2,7 +2,7 @@ import React from 'react'; export default function SocialLogin() { const socialLoginHandler = () => { - const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=http://http://mindcaptor.s3-website.ap-northeast-2.amazonaws.com&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; + const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=http://mindcaptor.s3-website.ap-northeast-2.amazonaws.com&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; window.location.assign(url); }; diff --git a/src/MainPages/main.js b/src/MainPages/main.js index 11c7ef7..416a67d 100644 --- a/src/MainPages/main.js +++ b/src/MainPages/main.js @@ -6,6 +6,7 @@ import SigninBtn from './components/SigninBtn'; import SignupBtn from './components/SignupBtn'; import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; +require('dotenv').config(); const axios = require('axios'); @@ -23,7 +24,7 @@ export default function Main({ loginHandler, handleGuestLogin }) { const guestLogIn = () => { axios - .get('ec2-3-139-101-167.us-east-2.compute.amazonaws.com/guest', + .get(`${process.env.SERVER}/guest`, { withCredentials: true }) diff --git a/src/MyPages/MyPage.js b/src/MyPages/MyPage.js index 93bf996..f6adf32 100644 --- a/src/MyPages/MyPage.js +++ b/src/MyPages/MyPage.js @@ -9,6 +9,7 @@ import Character1 from '../images/Character1.png'; import Character2 from '../images/Character2.png'; import Character3 from '../images/Character3.png'; import Character4 from '../images/Character4.png'; +require('dotenv').config(); function MyPage({ accessToken, refreshTokenRequest, userInfo }) { const PhotoData = [Character1, Character2, Character3, Character4]; @@ -61,7 +62,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) { const MyPageSaveData= async (PhotoNum) =>{ await refreshTokenRequest() - const SavePhoto = await axios.post(`ec2-3-139-101-167.us-east-2.compute.amazonaws.com/mypage/${id}/profile`, + const SavePhoto = await axios.post(`${process.env.SERVER}/mypage/${id}/profile`, {new_profile: PhotoNum}, { headers: { @@ -70,7 +71,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) { }, //withCredentials: true, }) - const SaveComment = await axios.post(`ec2-3-139-101-167.us-east-2.compute.amazonaws.com/mypage/${id}/comment`, + const SaveComment = await axios.post(`${process.env.SERVER}/${id}/comment`, {Comment: '아니라어민어리ㅏㅁㄴ얼'}, { headers: { From 2f6fc2c34894c82fed2487a929d71e50d4224161 Mon Sep 17 00:00:00 2001 From: jeasong Date: Fri, 7 May 2021 05:38:51 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=EA=B8=B4=EC=9E=A5=EB=8D=B0=EC=8A=A4?= =?UTF-8?q?=EB=84=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index c8c63b5..a88b7b2 100644 --- a/src/App.js +++ b/src/App.js @@ -28,7 +28,8 @@ export default function App() { //로그인 상태 관리하기-------------------------------- useEffect(() => { - + localStorage.setItem({a:'a'}) + console.log(localStorage.getItem('a')) //refreshTokenRequest() if(accessToken.accessToken!==null){ history.push('/Waiting') From 797d4ed9c8f6626166a6cc0b2fc3b3f27927ddb9 Mon Sep 17 00:00:00 2001 From: jeasong Date: Fri, 7 May 2021 14:34:25 +0900 Subject: [PATCH 5/5] done --- .env | 3 ++- .env.production | 1 + src/App.js | 11 ++++++----- src/GamePages/InGame.js | 2 +- src/GamePages/components/Canvas.js | 2 +- src/GamePages/components/Canvas3.js | 2 +- src/GamePages/components/Chat.js | 2 +- src/MainPages/components/Signin.js | 2 +- src/MainPages/components/Signup.js | 2 +- src/MainPages/components/SocialLogin.js | 4 ++-- src/MainPages/main.js | 2 +- src/WaitingPages/components/CreateGame.js | 3 ++- src/WaitingPages/components/EntryGame.js | 4 ++-- src/main.css | 3 --- 14 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 .env.production diff --git a/.env b/.env index 287a055..1fec409 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -SERVER=http://ec2-3-139-101-167.us-east-2.compute.amazonaws.com:80 \ No newline at end of file +REACT_APP_API_SERVER=http://localhost:4000 +DB_USER=root \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..5e3c068 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +REACT_APP_API_SERVER=http://ec2-3-139-101-167.us-east-2.compute.amazonaws.com:80 \ No newline at end of file diff --git a/src/App.js b/src/App.js index 5f0bd2d..e4deece 100644 --- a/src/App.js +++ b/src/App.js @@ -48,7 +48,7 @@ export default function App() { axios .get( - `${process.env.SERVER}/user/logout`, + `${process.env.REACT_APP_API_SERVER}/user/logout`, {withCredentials: true} ).then((res) => {}) setUserInfo({ @@ -67,7 +67,7 @@ export default function App() { const accessTokenRequest = (accessToken) => { // ! 유저 정보를 알려달라는 코드 axios - .get(`${process.env.SERVER}/accessTokenHandler`, { + .get(`${process.env.REACT_APP_API_SERVER}/accessTokenHandler`, { headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', @@ -99,9 +99,9 @@ export default function App() { }, [userInfo]); const refreshTokenRequest = () => { - // ! 일정 주기로 함수 계속 보냄http://ec2-3-139-101-167.us-east-2.compute.amazonaws.com:80 + // ! 일정 주기로 함수 계속 보냄 axios - .get(`${process.env.SERVER}/refreshTokenHandler`, { + .get(`${process.env.REACT_APP_API_SERVER}/refreshTokenHandler`, { withCredentials: true, }) .then((res) => { @@ -135,8 +135,9 @@ export default function App() { const getAccessToken = async (authorizationCode) => { // ! 구글 로그인 + console.log('ddddddddddddddddddddddddddddddddddddddddddldldldldldldldl') let resp = await axios.post( - `${process.env.SERVER}/googlelogin`, + `${process.env.REACT_APP_API_SERVER}/googlelogin`, { authorizationCode: authorizationCode, }, diff --git a/src/GamePages/InGame.js b/src/GamePages/InGame.js index bc338e1..c51a9b3 100644 --- a/src/GamePages/InGame.js +++ b/src/GamePages/InGame.js @@ -12,7 +12,7 @@ import { useHistory } from 'react-router-dom'; import Logo from './components/Logo'; import Canvas from './components/Canvas3'; require('dotenv').config(); -const socket = io.connect(`${process.env.SERVER}`, { +const socket = io.connect(`${process.env.REACT_APP_API_SERVER}`, { transports: ['websocket'], path: '/socket.io', }); diff --git a/src/GamePages/components/Canvas.js b/src/GamePages/components/Canvas.js index 9827ad2..3eb178d 100644 --- a/src/GamePages/components/Canvas.js +++ b/src/GamePages/components/Canvas.js @@ -151,7 +151,7 @@ export default function Canvas() { drawLine(data.x0 * w, data.y0 * h, data.x1 * w, data.y1 * h, data.color); }; - socketRef.current = io.connect(`${process.env.SERVER}`, { + socketRef.current = io.connect(`${process.env.REACT_APP_API_SERVER}`, { transports: ['websocket', 'polling'], path: '/socket.io', }); diff --git a/src/GamePages/components/Canvas3.js b/src/GamePages/components/Canvas3.js index 9330cfc..dd474d4 100644 --- a/src/GamePages/components/Canvas3.js +++ b/src/GamePages/components/Canvas3.js @@ -122,7 +122,7 @@ export default function Canvas3() { drawLine(data.x0 * w, data.y0 * h, data.x1 * w, data.y1 * h, data.color); }; - socketRef.current = io.connect(`${process.env.SERVER}`, { + socketRef.current = io.connect(`${process.env.REACT_APP_API_SERVER}`, { transports: ['websocket', 'polling'], path: '/socket.io', }); diff --git a/src/GamePages/components/Chat.js b/src/GamePages/components/Chat.js index ac8a4e1..fa4c5b8 100644 --- a/src/GamePages/components/Chat.js +++ b/src/GamePages/components/Chat.js @@ -35,7 +35,7 @@ export default function Chat({ chat, onMessageSubmit, onTextChange, state }) {
- + {/* */}
{ - const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=http://mindcaptor.s3-website.ap-northeast-2.amazonaws.com&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; - + let redirect_uri = {s3:'http://mindcaptor.s3-website.ap-northeast-2.amazonaws.com',local:'http://localhost:3000'} + const url = `https://accounts.google.com/o/oauth2/auth?client_id=970331179604-upa291p2st8pmj3676qmnm4geurg21cb.apps.googleusercontent.com&redirect_uri=${redirect_uri.s3}&response_type=code&scope=https://www.googleapis.com/auth/userinfo.profile email`; window.location.assign(url); }; return ( diff --git a/src/MainPages/main.js b/src/MainPages/main.js index 416a67d..7153ade 100644 --- a/src/MainPages/main.js +++ b/src/MainPages/main.js @@ -24,7 +24,7 @@ export default function Main({ loginHandler, handleGuestLogin }) { const guestLogIn = () => { axios - .get(`${process.env.SERVER}/guest`, + .get(`${process.env.REACT_APP_API_SERVER}/guest`, { withCredentials: true }) diff --git a/src/WaitingPages/components/CreateGame.js b/src/WaitingPages/components/CreateGame.js index 9835744..d6e1783 100644 --- a/src/WaitingPages/components/CreateGame.js +++ b/src/WaitingPages/components/CreateGame.js @@ -2,6 +2,7 @@ import axios from 'axios'; import { useHistory } from 'react-router-dom'; import React, { useEffect, useState } from 'react'; +require('dotenv').config() export default function CreateGame({ createModal, closeModal, accessToken }) { const [roomName, setRoomName] = useState(''); @@ -22,7 +23,7 @@ export default function CreateGame({ createModal, closeModal, accessToken }) { await axios .post( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/room/new', + `${process.env.REACT_APP_API_SERVER}/room/new`, { room_name, room_pw }, { headers: { diff --git a/src/WaitingPages/components/EntryGame.js b/src/WaitingPages/components/EntryGame.js index 658adf4..546842e 100644 --- a/src/WaitingPages/components/EntryGame.js +++ b/src/WaitingPages/components/EntryGame.js @@ -1,13 +1,13 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; import axios from 'axios'; - +require('dotenv').config() function EntryGame({ accessToken }) { const history = useHistory(); const handleUrl = async () => { const result = await axios.post( - 'ec2-3-139-101-167.us-east-2.compute.amazonaws.com/room/join', + `${process.env.REACT_APP_API_SERVER}/room/join`, {}, { headers: { diff --git a/src/main.css b/src/main.css index dbb2e05..1943c4a 100644 --- a/src/main.css +++ b/src/main.css @@ -1072,18 +1072,15 @@ canvas { } .res_body { - border: 2px solid white; } .res_body_header { text-align: center; color: white; - border: 2px solid red; font-size: 20px; } .res_body_winner { - border: 2px solid green; color: white; text-align: center;