Add new frontend - fix 5
This commit is contained in:
@@ -492,8 +492,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
bakery-network:
|
bakery-network:
|
||||||
ipv4_address: 172.20.0.200
|
ipv4_address: 172.20.0.200
|
||||||
profiles:
|
|
||||||
- monitoring
|
|
||||||
|
|
||||||
grafana:
|
grafana:
|
||||||
image: grafana/grafana:10.0.0
|
image: grafana/grafana:10.0.0
|
||||||
@@ -515,8 +513,6 @@ services:
|
|||||||
ipv4_address: 172.20.0.201
|
ipv4_address: 172.20.0.201
|
||||||
depends_on:
|
depends_on:
|
||||||
- prometheus
|
- prometheus
|
||||||
profiles:
|
|
||||||
- monitoring
|
|
||||||
|
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# FRONTEND - CLEAN CONFIG
|
# FRONTEND - CLEAN CONFIG
|
||||||
@@ -541,8 +537,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
bakery-network:
|
bakery-network:
|
||||||
ipv4_address: 172.20.0.110
|
ipv4_address: 172.20.0.110
|
||||||
profiles:
|
|
||||||
- frontend
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
|
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|||||||
@@ -320,5 +320,5 @@ class ApiClient {
|
|||||||
|
|
||||||
// Create default instance
|
// Create default instance
|
||||||
export const apiClient = new ApiClient({
|
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('password', credentials.password);
|
||||||
formData.append('grant_type', 'password');
|
formData.append('grant_type', 'password');
|
||||||
|
|
||||||
const response = await fetch('/api/auth/token', {
|
const response = await fetch('/auth/login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
@@ -55,12 +55,6 @@ class AuthService {
|
|||||||
async register(data: RegisterData): Promise<UserProfile> {
|
async register(data: RegisterData): Promise<UserProfile> {
|
||||||
const response = await apiClient.post('/auth/register', data);
|
const response = await apiClient.post('/auth/register', data);
|
||||||
|
|
||||||
// Auto-login after registration
|
|
||||||
await this.login({
|
|
||||||
email: data.email,
|
|
||||||
password: data.password
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|||||||
const register = useCallback(async (data: any) => {
|
const register = useCallback(async (data: any) => {
|
||||||
const profile = await authService.register(data);
|
const profile = await authService.register(data);
|
||||||
setUser(profile);
|
setUser(profile);
|
||||||
}, []);
|
await login(data.email, data.password); // Reuse the login function
|
||||||
|
}, [login]);
|
||||||
|
|
||||||
const logout = useCallback(async () => {
|
const logout = useCallback(async () => {
|
||||||
await authService.logout();
|
await authService.logout();
|
||||||
|
|||||||
@@ -20,11 +20,9 @@ import { ErrorBoundary } from '../../components/common/ErrorBoundary';
|
|||||||
import {
|
import {
|
||||||
dataApi,
|
dataApi,
|
||||||
forecastingApi,
|
forecastingApi,
|
||||||
trainingApi, // Assuming a trainingApi service exists, potentially part of dataApi
|
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ForecastRecord,
|
ForecastRecord,
|
||||||
SalesRecord,
|
SalesRecord,
|
||||||
TrainingTask,
|
|
||||||
TrainingRequest,
|
TrainingRequest,
|
||||||
} from '../../api/services/api'; // Consolidated API services and types
|
} from '../../api/services/api'; // Consolidated API services and types
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user