Skip to content

Commit 8a6d7fb

Browse files
authored
Merge pull request #67 from UTSC-CSCC01-Software-Engineering-I/bug/database-migration
Fix endpoints
2 parents 15f6266 + 58890e7 commit 8a6d7fb

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

epiready-frontend/src/components/Chat/ChatInterface.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const ChatInterface = () => {
3232

3333
// Import socket.io-client dynamically
3434
import('socket.io-client').then(({ default: io }) => {
35-
socketRef.current = io('http://127.0.0.1:5000', {
35+
socketRef.current = io(`${import.meta.env.VITE_BACKEND_URL}`, {
3636
auth: { token: `${token}` }
3737
});
3838

@@ -55,7 +55,7 @@ const ChatInterface = () => {
5555
if (!token) return;
5656

5757
try {
58-
const response = await fetch("http://127.0.0.1:5000/api/chat/rooms", {
58+
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/chat/rooms`, {
5959
headers: {
6060
"Authorization": `${token}`
6161
}
@@ -90,7 +90,7 @@ const ChatInterface = () => {
9090
if (!token) return;
9191

9292
try {
93-
const response = await fetch(`http://127.0.0.1:5000/api/chat/messages?room_id=${roomId}`, {
93+
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/chat/messages?room_id=${roomId}`, {
9494
headers: {
9595
"Authorization": `${token}`
9696
}

epiready-frontend/src/components/Chat/ChatWindow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ChatWindow = ({ selectedRoom, messages, onSendMessage }) => {
2323
if (!token) return;
2424

2525
try {
26-
const response = await fetch("http://127.0.0.1:5000/api/users", {
26+
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/users`, {
2727
method: "POST",
2828
headers: {
2929
"Authorization": `${token}`

epiready-frontend/src/components/Chat/CreateChatModal.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const CreateChatModal = ({ onClose, onChatCreated }) => {
1717
if (!token) return;
1818

1919
try {
20-
const response = await fetch("http://127.0.0.1:5000/api/chat/users", {
20+
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/chat/users`, {
2121
headers: {
2222
"Authorization": `${token}`
2323
}
@@ -65,7 +65,7 @@ const CreateChatModal = ({ onClose, onChatCreated }) => {
6565
? { other_user_id: selectedUsers[0] }
6666
: { name: groupName, participant_ids: selectedUsers };
6767

68-
const response = await fetch(`http://127.0.0.1:5000/api/chat${endpoint}`, {
68+
const response = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/chat${endpoint}`, {
6969
method: 'POST',
7070
headers: {
7171
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)