diff --git a/client/src/context/AuthContext.jsx b/client/src/context/AuthContext.jsx index 0f39e8f..09fc9f5 100644 --- a/client/src/context/AuthContext.jsx +++ b/client/src/context/AuthContext.jsx @@ -4,8 +4,8 @@ import axios from "axios"; export const AuthContext = createContext(); export const AuthProvider = ({ children }) => { - const API_URL = `${import.meta.env.API_URL}/api/auth`; - + const API_URL = `${import.meta.env.VITE_API_URL}/api/auth`; + console.log(API_URL); const [user, setUser] = useState(() => { const savedUser = localStorage.getItem("user"); return savedUser ? JSON.parse(savedUser) : null; diff --git a/client/src/views/MainMenu/sections/ServerSection.jsx b/client/src/views/MainMenu/sections/ServerSection.jsx index 50183f5..474ccba 100644 --- a/client/src/views/MainMenu/sections/ServerSection.jsx +++ b/client/src/views/MainMenu/sections/ServerSection.jsx @@ -12,8 +12,8 @@ const ServerSection = ({ onBack, onSelect }) => { const fetchServers = async () => { setLoading(true); const startTime = Date.now(); + const API_URL = import.meta.env.VITE_API_URL; try { - const API_URL = import.meta.env.API_URL; const response = await axios.get(`${API_URL}/api/servers/list`); const elapsedTime = Date.now() - startTime; @@ -30,12 +30,12 @@ const ServerSection = ({ onBack, onSelect }) => { const handleJoinServer = async (server) => { setJoiningId(server._id); - + const API_URL = import.meta.env.VITE_API_URL; try { const token = JSON.parse(localStorage.getItem("user")).token; const response = await axios.post( - "http://localhost:3000/api/servers/join", + `${API_URL}/api/servers/join`, { serverId: server._id },