Skip to content

Commit 64d67a9

Browse files
committed
Standardize URLs
1 parent 2deb1ee commit 64d67a9

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

frontend/src/config/api.config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import type { Endpoints } from "../types/api.types";
44
const isProduction = import.meta.env.PROD;
55

66
export const SERVER_URL = isProduction
7-
? (import.meta.env.VITE_SERVER_URL || 'https://talketeer.onrender.com')
8-
: (import.meta.env.VITE_DEV_SERVER_URL || 'https://localhost:3000');
9-
export const API_URL = SERVER_URL + '/talketeer/api';
7+
? import.meta.env.VITE_SERVER_URL
8+
: import.meta.env.VITE_DEV_SERVER_URL;
109

11-
export const SOCKET_SERVER_URL = SERVER_URL;
10+
export const API_URL = SERVER_URL + `${isProduction ? '/talketeer/api' : '/api'}`;
1211

1312
export const API = axios.create({
1413
baseURL: API_URL

frontend/src/socket.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { io } from 'socket.io-client';
2-
import { SOCKET_SERVER_URL } from './config/api.config';
2+
import { SERVER_URL } from './config/api.config';
33
import type { TalketeerSocket } from './types/socket.types';
44

5-
export const socket: TalketeerSocket = io(SOCKET_SERVER_URL, { withCredentials: true, autoConnect: false, path: '/talketeer/socket.io/' }) as TalketeerSocket;
5+
export const socket: TalketeerSocket = io(SERVER_URL, {
6+
withCredentials: true,
7+
autoConnect: false,
8+
path: '/talketeer/socket.io/'
9+
}) as TalketeerSocket;

0 commit comments

Comments
 (0)