Skip to content

Commit

Permalink
chore: change base_url source
Browse files Browse the repository at this point in the history
  • Loading branch information
flowersayo committed May 8, 2023
1 parent a349189 commit 810e43c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 14 deletions.
5 changes: 5 additions & 0 deletions client/src/Constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*세팅 값*/
export const COOL_TIME = 1;
export const TIME_DURATION = 60; // 게임 시간
export const TIME_OFFSET = 5; //
export const RESULT_TIME = 20; // 결과창 보는시간
2 changes: 1 addition & 1 deletion client/src/components/gameroom/RPSSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useParams } from "react-router-dom";
import { useContext } from "react";
import { WebsocketContext } from "../../utils/WebSocketProvider";
import useInterval from "../../utils/useInterval";
import { COOL_TIME } from "../../Config";
import { COOL_TIME } from "../../Constants";
import { GradientText } from "../../styles/font";
import { isMobile } from "react-device-detect";

Expand Down
3 changes: 1 addition & 2 deletions client/src/pages/GameResultPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import ResultBoard from "../components/gameroom/ResultBoard";
import Button from "../components/common/Button";
import styled from "styled-components";

import { RESULT_TIME } from "../Constants";
import { useParams } from "react-router-dom";
import { useNavigate, useLocation } from "react-router-dom";
import { getUserId } from "../utils/User";
Expand All @@ -15,7 +15,6 @@ import { Medium } from "../styles/font";
import { useMediaQuery } from "react-responsive";
import SizedBox from "../components/common/SizedBox";
import useInterval from "../utils/useInterval";
import { RESULT_TIME } from "../Config";

export default function GameResultPage() {
const mode = useContext(LanguageContext);
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import { useRef, createContext, useEffect } from "react";
import { LanguageContext } from "../utils/LanguageProvider";
import { getUserName, setUserName } from "../utils/User";
import { Language } from "../db/Language";
import { BASE_WEBSOCKET_URL } from "../Config";

import { WebsocketContext } from "../utils/WebSocketProvider";
import { useMediaQuery } from "react-responsive";
import { BASE_SERVER_URL } from "../Config";
import qs from "qs";
function RuleBox() {
const mode = useContext(LanguageContext);
Expand Down Expand Up @@ -68,10 +69,9 @@ function LoginBox() {
client_secret: "",
};

console.log(process.env.REACT_APP_BASE_SERVER_URL);
axios
.post(
`${process.env.REACT_APP_BASE_SERVER_URL}/token`,
`${BASE_SERVER_URL}/token`,
/*json을 queryString 타입의 text로 변환*/
qs.stringify(body),
{
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/MobileGameResultScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LanguageContext } from "../utils/LanguageProvider";
import { Medium } from "../styles/font";
import { useMediaQuery } from "react-responsive";
import SizedBox from "../components/common/SizedBox";
import { RESULT_TIME } from "../Config";
import { RESULT_TIME } from "../Constants";
import useInterval from "../utils/useInterval";

export default function MobileGameResultScreen() {
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/MobileLandingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import { LanguageContext } from "../utils/LanguageProvider";

import { getUserName, setUserName } from "../utils/User";
import { Language } from "../db/Language";
import { BASE_WEBSOCKET_URL } from "../Config";

import { WebsocketContext } from "../utils/WebSocketProvider";
import { useMediaQuery } from "react-responsive";
import axios from "axios";
import qs from "qs";
import { BASE_SERVER_URL } from "../Config";
function Tabs({ currentTab, setCurrentTab }) {
const mode = useContext(LanguageContext);
return (
Expand Down Expand Up @@ -135,7 +136,7 @@ function LoginBox() {

axios
.post(
`${process.env.REACT_APP_BASE_SERVER_URL}/token`,
`${BASE_SERVER_URL}/token`,
/*json을 queryString 타입의 text로 변환*/
qs.stringify(body),
{
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/MobileWatingRoomScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
import { WebsocketContext } from "../utils/WebSocketProvider";
import { useContext } from "react";
import { useRef } from "react";
import { RESULT_TIME, TIME_DURATION, TIME_OFFSET } from "../Config";
import { PASSWORD } from "../Config";
import { RESULT_TIME, TIME_DURATION, TIME_OFFSET } from "../Constants";

import { Language } from "../db/Language";
import { LanguageContext } from "../utils/LanguageProvider";
import { MediumOutline } from "../styles/font";
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/WatingGamePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
import { WebsocketContext } from "../utils/WebSocketProvider";
import { useContext } from "react";
import { useRef } from "react";
import { TIME_DURATION, TIME_OFFSET } from "../Config";
import { PASSWORD } from "../Config";
import { TIME_DURATION, TIME_OFFSET } from "../Constants";

import { Language } from "../db/Language";
import { LanguageContext } from "../utils/LanguageProvider";
import { MediumOutline } from "../styles/font";
Expand Down
6 changes: 5 additions & 1 deletion client/src/utils/WebSocketProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { setIsLogin } from "./User";
import { Language } from "../db/Language";
import { LanguageContext } from "./LanguageProvider";
import { useContext } from "react";
import { BASE_WEBSOCKET_URL } from "../Config";
export const WebsocketContext = createContext([
() => {},
false,
Expand Down Expand Up @@ -33,7 +34,7 @@ export const WebsocketProvider = ({ children }) => {

console.log(token);
const socket = new WebSocket(
`${process.env.REACT_APP_BASE_WEBSOCKET_URL}/signin?name=${name}&token=${token}`
`${BASE_WEBSOCKET_URL}/signin?name=${name}&token=${token}`
);

socket.onopen = (event) => {
Expand All @@ -43,6 +44,9 @@ export const WebsocketProvider = ({ children }) => {

socket.onclose = (event) => {
console.log("onclose!", event);

// 방목록에서 <- 버튼 눌렀을때는 제외하구

alert(Language[mode].reconnection_request);
setIsReady(false);
navigate("/");
Expand Down

0 comments on commit 810e43c

Please sign in to comment.