Skip to content
Merged
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
3 changes: 1 addition & 2 deletions src/components/codecast/api/collab.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import config from "../../../config";
export async function createRoom({ token, name /*, code*/ }) {
if (!token) throw new Error("NO_TOKEN");

// const url = `${config.API_BASE_URL}/api/collab/rooms`;
const url = `http://52.79.145.160:8080/api/collab/rooms`;
const url = `${config.API_BASE_URL}/api/collab/rooms`;

// 스웨거 기준 roomName만 전송
const body = { roomName: name };
Expand Down
4 changes: 3 additions & 1 deletion src/components/codecast/api/roomAdmin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// src/components/codecast/api/roomAdmin.js
const API_BASE = process.env.REACT_APP_API_BASE_URL || 'http://52.79.145.160:8080';
import config from "../../../config";

const API_BASE = process.env.REACT_APP_API_BASE_URL || config.API_BASE_URL;

async function req(path, { method = 'GET', token, body } = {}) {
const res = await fetch(`${API_BASE}${path}`, {
Expand Down
3 changes: 1 addition & 2 deletions src/components/codecast/api/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import config from "../../../config";

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

const res = await fetch(url, {
method: "POST",
Expand Down
6 changes: 4 additions & 2 deletions src/components/codecast/hooks/useCollabSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import { useRef, useCallback } from "react";
import SockJS from "sockjs-client";
import { Client } from "@stomp/stompjs";
import config from "../../../config";

const COLLAB_SOCKET_URL = `${config.API_BASE_URL}/ws-collab`;

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

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

const client = new Client({
webSocketFactory: () => sock,
Expand Down