Features: - FastAPI backend for scraping attendance and journey book data - Deterministic kilometer distribution with random variance - Refueling form filling with km values - Next.js frontend with date range selector - Docker deployment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
550 B
TypeScript
23 lines
550 B
TypeScript
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
|
|
|
|
export const apiClient = {
|
|
async post(endpoint: string, data: any) {
|
|
const response = await fetch(`${API_URL}${endpoint}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify(data),
|
|
})
|
|
|
|
if (!response.ok) {
|
|
const errorData = await response.json()
|
|
throw new Error(errorData.detail || 'Request failed')
|
|
}
|
|
|
|
return response
|
|
}
|
|
}
|
|
|
|
export default API_URL
|