fix: Add /api and /ws paths to backend URLs for correct routing
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# API Configuration
|
# API Configuration
|
||||||
# Backend API base URL
|
# Backend API base URL (must include /api path)
|
||||||
VITE_API_URL=http://localhost:8080/api
|
VITE_API_URL=http://localhost:8080/api
|
||||||
|
|
||||||
# WebSocket Configuration
|
# WebSocket Configuration
|
||||||
# WebSocket server URL for real-time collaboration
|
# WebSocket server URL for real-time collaboration (must include /ws path)
|
||||||
VITE_WS_URL=ws://localhost:8080/ws
|
VITE_WS_URL=ws://localhost:8080/ws
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const API_BASE_URL = import.meta.env.VITE_API_URL || "https://docnest-backend-mingda.fly.dev";
|
const API_BASE_URL = import.meta.env.VITE_API_URL || "https://docnest-backend-mingda.fly.dev/api";
|
||||||
|
|
||||||
export async function authFetch(url: string, options?: RequestInit): Promise<Response> {
|
export async function authFetch(url: string, options?: RequestInit): Promise<Response> {
|
||||||
const token = localStorage.getItem('auth_token');
|
const token = localStorage.getItem('auth_token');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { WebsocketProvider } from "y-websocket";
|
|||||||
import * as Y from "yjs";
|
import * as Y from "yjs";
|
||||||
import { documentsApi } from "../api/document";
|
import { documentsApi } from "../api/document";
|
||||||
|
|
||||||
const WS_URL = import.meta.env.VITE_WS_URL || "wss://docnest-backend-mingda.fly.dev";
|
const WS_URL = import.meta.env.VITE_WS_URL || "wss://docnest-backend-mingda.fly.dev/ws";
|
||||||
|
|
||||||
export interface YjsProviders {
|
export interface YjsProviders {
|
||||||
ydoc: Y.Doc;
|
ydoc: Y.Doc;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { useAuth } from '../contexts/AuthContext';
|
import { useAuth } from '../contexts/AuthContext';
|
||||||
import './LoginPage.css';
|
import './LoginPage.css';
|
||||||
|
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_URL || "http://localhost:8080/api";
|
const API_BASE_URL = import.meta.env.VITE_API_URL || "https://docnest-backend-mingda.fly.dev/api";
|
||||||
|
|
||||||
function LoginPage() {
|
function LoginPage() {
|
||||||
const { user, loading } = useAuth();
|
const { user, loading } = useAuth();
|
||||||
|
|||||||
Reference in New Issue
Block a user