fix import
This commit is contained in:
parent
386b0a37e4
commit
4ad756f4d9
@ -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;
|
||||
|
||||
@ -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 },
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user