- Add React Native Expo field app for mobile staff - Use main /appointments/ endpoint with date range support - Add X-Business-Subdomain header for tenant context - Support day/week view navigation - Remove WebSocket console logging from frontend - Update AppointmentStatus type to include all backend statuses - Add responsive status legend to scheduler header 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
887 B
TypeScript
36 lines
887 B
TypeScript
/**
|
|
* Authentication API
|
|
*/
|
|
|
|
import axios from 'axios';
|
|
import { API_BASE_URL } from '../config/api';
|
|
import type { LoginCredentials, AuthResponse, User } from '../types';
|
|
import apiClient from './client';
|
|
|
|
// Login uses the main auth endpoint, not the mobile API
|
|
const authAxios = axios.create({
|
|
baseURL: API_BASE_URL,
|
|
timeout: 30000,
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
export async function loginApi(credentials: LoginCredentials): Promise<AuthResponse> {
|
|
const response = await authAxios.post<AuthResponse>('/auth/login/', credentials);
|
|
return response.data;
|
|
}
|
|
|
|
export async function getProfile(): Promise<User> {
|
|
const response = await apiClient.get<User>('/me/');
|
|
return response.data;
|
|
}
|
|
|
|
export async function logoutApi(): Promise<void> {
|
|
try {
|
|
await apiClient.post('/logout/');
|
|
} catch (error) {
|
|
// Ignore logout errors
|
|
}
|
|
}
|