Skip to content

Commit b41981f

Browse files
committed
refactoring completed
1 parent 1a90473 commit b41981f

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎front/dev.env‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
NODE_ENV=development
2-
API_URL=http://localhost:8081
2+
BASE_API_URL=http://localhost:8081
33
BASE_SOCKET_URL=http://localhost:3001

‎front/prod.env‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
NODE_ENV=production
2-
API_URL=http://localhost:8080
2+
BASE_API_URL=http://localhost:8080
33
BASE_SOCKET_URL=http://localhost:3001

‎front/src/core/api.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as ioClient from 'socket.io-client';
22
import { Socket } from 'socket.io';
3+
import { baseSocketUrl } from './const';
34

45
export interface ConnectionSetup {
56
room: string;
@@ -9,7 +10,7 @@ export interface ConnectionSetup {
910
export const createSocket = (connectionSetup: ConnectionSetup): Socket => {
1011
const { room, trainertoken } = connectionSetup;
1112
const socketParams = {
12-
url: process.env.BASE_SOCKET_URL,
13+
url: baseSocketUrl,
1314
options: {
1415
query: { room, trainertoken },
1516
timeout: 60000,

‎front/src/core/const.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
export const baseApiUrl = process.env.BASE_API_URL;
2+
export const baseSocketUrl = process.env.BASE_SOCKET_URL;
3+
14
export const SocketOuputMessageLiteral = {
25
MESSAGE: 'message',
36
};

‎front/src/pods/create-session/api/create-session.api.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Axios from 'axios';
2+
import { baseApiUrl } from 'core';
23

3-
const getRoomUrl = `${process.env.API_URL}/api/create-room`;
4+
const getRoomUrl = `${baseApiUrl}/api/create-room`;
45

56
interface SessionInfo {
67
room: string;

0 commit comments

Comments
 (0)