Skip to content

Commit 8d6e68b

Browse files
authored
Merge pull request #94 from DMU-DebugVisual/inseong
api url refactoring
2 parents 207bdf1 + 1c0089f commit 8d6e68b

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/components/codecast/api/collab.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import config from "../../../config";
33
export async function createRoom({ token, name /*, code*/ }) {
44
if (!token) throw new Error("NO_TOKEN");
55

6-
// const url = `${config.API_BASE_URL}/api/collab/rooms`;
7-
const url = `http://52.79.145.160:8080/api/collab/rooms`;
6+
const url = `${config.API_BASE_URL}/api/collab/rooms`;
87

98
// 스웨거 기준 roomName만 전송
109
const body = { roomName: name };

src/components/codecast/api/roomAdmin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// src/components/codecast/api/roomAdmin.js
2-
const API_BASE = process.env.REACT_APP_API_BASE_URL || 'http://52.79.145.160:8080';
2+
import config from "../../../config";
3+
4+
const API_BASE = process.env.REACT_APP_API_BASE_URL || config.API_BASE_URL;
35

46
async function req(path, { method = 'GET', token, body } = {}) {
57
const res = await fetch(`${API_BASE}${path}`, {

src/components/codecast/api/sessions.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import config from "../../../config";
33

44
export async function createSession({ token, roomId, fileName, language }) {
5-
// const url = `${config.API_BASE_URL}/api/collab/rooms/${roomId}/sessions`;
6-
const url = `http://52.79.145.160:8080/api/collab/rooms/${roomId}/sessions`;
5+
const url = `${config.API_BASE_URL}/api/collab/rooms/${roomId}/sessions`;
76

87
const res = await fetch(url, {
98
method: "POST",

src/components/codecast/hooks/useCollabSocket.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import { useRef, useCallback } from "react";
33
import SockJS from "sockjs-client";
44
import { Client } from "@stomp/stompjs";
5+
import config from "../../../config";
6+
7+
const COLLAB_SOCKET_URL = `${config.API_BASE_URL}/ws-collab`;
58

69
/**
710
* STOMP/SockJS 래퍼 훅 (견고 버전)
@@ -63,8 +66,7 @@ export default function useCollabSocket() {
6366
isConnectingRef.current = true;
6467

6568
return new Promise((resolve, reject) => {
66-
const sockUrl = `http://52.79.145.160:8080/ws-collab`; // 필요시 config로 이동
67-
const sock = new SockJS(sockUrl);
69+
const sock = new SockJS(COLLAB_SOCKET_URL);
6870

6971
const client = new Client({
7072
webSocketFactory: () => sock,

0 commit comments

Comments
 (0)