Add new frontend - fix 5

This commit is contained in:
Urtzi Alfaro
2025-07-22 10:17:41 +02:00
parent 52232815a2
commit 915be54349
5 changed files with 4 additions and 17 deletions

View File

@@ -492,8 +492,6 @@ services:
networks:
bakery-network:
ipv4_address: 172.20.0.200
profiles:
- monitoring
grafana:
image: grafana/grafana:10.0.0
@@ -515,8 +513,6 @@ services:
ipv4_address: 172.20.0.201
depends_on:
- prometheus
profiles:
- monitoring
# ================================================================
# FRONTEND - CLEAN CONFIG
@@ -541,8 +537,6 @@ services:
networks:
bakery-network:
ipv4_address: 172.20.0.110
profiles:
- frontend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
interval: 30s

View File

@@ -320,5 +320,5 @@ class ApiClient {
// Create default instance
export const apiClient = new ApiClient({
baseURL: process.env.REACT_APP_API_URL || 'http://localhost:8000/api'
baseURL: process.env.REACT_APP_API_URL || 'http://localhost:8000/api/v1'
});

View File

@@ -32,7 +32,7 @@ class AuthService {
formData.append('password', credentials.password);
formData.append('grant_type', 'password');
const response = await fetch('/api/auth/token', {
const response = await fetch('/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
@@ -55,12 +55,6 @@ class AuthService {
async register(data: RegisterData): Promise<UserProfile> {
const response = await apiClient.post('/auth/register', data);
// Auto-login after registration
await this.login({
email: data.email,
password: data.password
});
return response;
}

View File

@@ -57,7 +57,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
const register = useCallback(async (data: any) => {
const profile = await authService.register(data);
setUser(profile);
}, []);
await login(data.email, data.password); // Reuse the login function
}, [login]);
const logout = useCallback(async () => {
await authService.logout();

View File

@@ -20,11 +20,9 @@ import { ErrorBoundary } from '../../components/common/ErrorBoundary';
import {
dataApi,
forecastingApi,
trainingApi, // Assuming a trainingApi service exists, potentially part of dataApi
ApiResponse,
ForecastRecord,
SalesRecord,
TrainingTask,
TrainingRequest,
} from '../../api/services/api'; // Consolidated API services and types