Skip to content

Commit

Permalink
change config variables to env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
flowersayo committed May 8, 2023
1 parent cecc594 commit 02ac2ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
MobileRoomListScreen,
} from "./pages";
import { Route, Routes } from "react-router-dom";
import { BASE_WEBSOCKET_URL } from "./Config";
import styled from "styled-components";
import "./App.css";
import { useState, useRef, useEffect, createContext } from "react";
Expand Down
9 changes: 5 additions & 4 deletions client/src/pages/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Language } from "../db/Language";

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 @@ -64,10 +64,11 @@ function LoginBox() {
if (!isLoading) {
setIsLoading(true);
console.log("요청!");

var body = {
grant_type: "",
username: "rpsbro",
password: "rpsDance",
username: process.env.RPS_USERNAME,
password: process.env.RPS_PASSWORD,
scope: "",
client_id: "",
client_secret: "",
Expand All @@ -76,7 +77,7 @@ function LoginBox() {
try {
/*비동기 요청*/
const response = await axios.post(
`${BASE_SERVER_URL}/token`,
`${process.env.RPS_BASE_SERVER_URL}/token`,
qs.stringify(body),
{
headers: {
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/MobileLandingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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 @@ -131,8 +131,8 @@ function LoginBox() {
console.log("요청!");
var body = {
grant_type: "",
username: "rpsbro",
password: "rpsDance",
username: process.env.RPS_USERNAME,
password: process.env.RPS_PASSWORD,
scope: "",
client_id: "",
client_secret: "",
Expand All @@ -141,7 +141,7 @@ function LoginBox() {
try {
/*비동기 요청*/
const response = await axios.post(
`${BASE_SERVER_URL}/token`,
`${process.env.RPS_BASE_SERVER_URL}/token`,
qs.stringify(body),
{
headers: {
Expand Down
3 changes: 1 addition & 2 deletions client/src/utils/WebSocketProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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([
() => {},
Expand Down Expand Up @@ -37,7 +36,7 @@ export const WebsocketProvider = ({ children }) => {
console.log(token);

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

socket.onopen = (event) => {
Expand Down

0 comments on commit 02ac2ed

Please sign in to comment.