Add new frontend - fix 5
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user