Fix double /api/ prefix in API endpoint calls

When VITE_API_URL=/api, axios baseURL is already set to /api. However, all endpoint calls included the /api/ prefix, creating double paths like /api/api/auth/login/.

Removed /api/ prefix from 81 API endpoint calls across 22 files:
- src/api/auth.ts - Fixed login, logout, me, refresh, hijack endpoints
- src/api/client.ts - Fixed token refresh endpoint
- src/api/profile.ts - Fixed all profile, email, password, MFA, sessions endpoints
- src/hooks/*.ts - Fixed all remaining API calls (users, appointments, resources, etc)
- src/pages/*.tsx - Fixed signup and email verification endpoints

This ensures API requests use the correct path: /api/auth/login/ instead of /api/api/auth/login/

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
poduck
2025-11-30 15:27:57 -05:00
parent f1d4dac9d2
commit 4cd6610f2a
53 changed files with 476 additions and 687 deletions

View File

@@ -88,7 +88,7 @@ export function DevQuickLogin({ embedded = false }: DevQuickLoginProps) {
setLoading(user.username);
try {
// Call token auth API
const response = await apiClient.post('/api/auth-token/', {
const response = await apiClient.post('/auth-token/', {
username: user.username,
password: user.password,
});
@@ -97,7 +97,7 @@ export function DevQuickLogin({ embedded = false }: DevQuickLoginProps) {
setCookie('access_token', response.data.token, 7);
// Fetch user data to determine redirect
const userResponse = await apiClient.get('/api/auth/me/');
const userResponse = await apiClient.get('/auth/me/');
const userData = userResponse.data;
// Determine the correct subdomain based on user role

View File

@@ -5,6 +5,7 @@ import { Menu, X, Sun, Moon } from 'lucide-react';
import SmoothScheduleLogo from '../SmoothScheduleLogo';
import LanguageSelector from '../LanguageSelector';
import { User } from '../../api/auth';
import { buildSubdomainUrl } from '../../utils/domain';
interface NavbarProps {
darkMode: boolean;
@@ -47,10 +48,10 @@ const Navbar: React.FC<NavbarProps> = ({ darkMode, toggleTheme, user }) => {
const protocol = window.location.protocol;
if (['superuser', 'platform_manager', 'platform_support'].includes(user.role)) {
return `${protocol}//platform.lvh.me${port}/`;
return buildSubdomainUrl('platform', '/');
}
if (user.business_subdomain) {
return `${protocol}//${user.business_subdomain}.lvh.me${port}/`;
return buildSubdomainUrl(user.business_subdomain, '/');
}
return '/login';
};