From 7af2103164b15976665e4a02a3dbf255b43bf677 Mon Sep 17 00:00:00 2001 From: Xor290 Date: Sat, 9 May 2026 16:50:23 +0200 Subject: [PATCH] chore: build --- frontend-admin/eas.json | 6 +++--- frontend-admin/src/api/api_admin.ts | 7 ++++--- frontend-admin/src/api/api_cabine.ts | 6 ++++-- frontend-admin/src/api/api_delivery.ts | 3 ++- frontend-admin/src/api/client.ts | 3 +-- mobile/eas.json | 6 +++--- mobile/src/api/api.ts | 13 ++++++++++--- mobile/src/api/client.ts | 3 ++- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/frontend-admin/eas.json b/frontend-admin/eas.json index 4fba5714..f62e5b47 100644 --- a/frontend-admin/eas.json +++ b/frontend-admin/eas.json @@ -15,7 +15,7 @@ "simulator": true }, "env": { - "API_URL": "https://mln-uber.club" + "EXPO_PUBLIC_API_URL": "https://5.181.0.112.nip.io" } }, "preview": { @@ -24,7 +24,7 @@ "buildType": "apk" }, "env": { - "API_URL": "https://mln-uber.club" + "EXPO_PUBLIC_API_URL": "https://5.181.0.112.nip.io" } }, "production": { @@ -34,7 +34,7 @@ "buildType": "apk" }, "env": { - "API_URL": "https://mln-uber.club" + "EXPO_PUBLIC_API_URL": "https://mln-uber.club" } } } diff --git a/frontend-admin/src/api/api_admin.ts b/frontend-admin/src/api/api_admin.ts index 63877bad..6e87d48a 100644 --- a/frontend-admin/src/api/api_admin.ts +++ b/frontend-admin/src/api/api_admin.ts @@ -1,4 +1,5 @@ import apiClient from "./client"; +import { API_BASE_URL } from "./client"; import type { AuthResponse, ClientResponse, @@ -9,9 +10,9 @@ import type { Alert, } from "./types"; -const V2 = "https://mln-uber.club/api/v2"; -const CABINE_URL = "https://mln-uber.club/api/v1/cabine"; -const V1_PUBLIC = "https://mln-uber.club/api/v1"; +const V2 = `${API_BASE_URL}/api/v2`; +const CABINE_URL = `${API_BASE_URL}/api/v1/cabine`; +const V1_PUBLIC = `${API_BASE_URL}/api/v1`; export const loginAdmin = async ( username: string, diff --git a/frontend-admin/src/api/api_cabine.ts b/frontend-admin/src/api/api_cabine.ts index 953f2073..4a5b9808 100644 --- a/frontend-admin/src/api/api_cabine.ts +++ b/frontend-admin/src/api/api_cabine.ts @@ -1,4 +1,6 @@ import apiClient from "./client"; +import { API_BASE_URL } from "./client"; + import type { OrderItem, DeliveryPerson, @@ -6,8 +8,8 @@ import type { Alert, } from "./types"; -const API = "https://mln-uber.club/api/v1/cabine"; -const V2 = "https://mln-uber.club/api/v2"; +const API = `${API_BASE_URL}/api/v1/cabine`; +const V2 = `${API_BASE_URL}/api/v2`; export const getCommandItems = async (commandId: number) => { const { data } = await apiClient.get(`${API}/commands/${commandId}/items`); diff --git a/frontend-admin/src/api/api_delivery.ts b/frontend-admin/src/api/api_delivery.ts index e6bf0183..0dcdc860 100644 --- a/frontend-admin/src/api/api_delivery.ts +++ b/frontend-admin/src/api/api_delivery.ts @@ -1,4 +1,5 @@ import apiClient from "./client"; +import { API_BASE_URL } from "./client"; import type { DeliveryStatus, QueueInfo, @@ -7,7 +8,7 @@ import type { Alert, } from "./types"; -const API = "https://mln-uber.club/api/v1/livreur"; +const API = `${API_BASE_URL}/api/v1/livreur`; // ============================================ // STATUT diff --git a/frontend-admin/src/api/client.ts b/frontend-admin/src/api/client.ts index 16b4521e..921186d9 100644 --- a/frontend-admin/src/api/client.ts +++ b/frontend-admin/src/api/client.ts @@ -1,8 +1,7 @@ import axios from "axios"; import { getToken, getAdminToken } from "../auth/tokenStorage"; -// Change this to your server IP/domain -export const API_BASE_URL = "https://mln-uber.club"; +export const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL ?? "https://mln-uber.club"; const apiClient = axios.create({ baseURL: API_BASE_URL, diff --git a/mobile/eas.json b/mobile/eas.json index 0ad54c20..8de57c71 100644 --- a/mobile/eas.json +++ b/mobile/eas.json @@ -15,7 +15,7 @@ "simulator": true }, "env": { - "API_URL": "https://5.181.0.112.nip.io" + "EXPO_PUBLIC_API_URL": "https://5.181.0.112.nip.io" }, "channel": "development" }, @@ -25,7 +25,7 @@ "buildType": "apk" }, "env": { - "API_URL": "https://5.181.0.112.nip.io" + "EXPO_PUBLIC_API_URL": "https://5.181.0.112.nip.io" }, "channel": "preview" }, @@ -36,7 +36,7 @@ "buildType": "apk" }, "env": { - "API_URL": "https://5.181.0.112.nip.io/" + "EXPO_PUBLIC_API_URL": "https://mln-uber.club" }, "channel": "production" } diff --git a/mobile/src/api/api.ts b/mobile/src/api/api.ts index 7f9de019..dc713f26 100644 --- a/mobile/src/api/api.ts +++ b/mobile/src/api/api.ts @@ -1,4 +1,5 @@ import apiClient from "./client"; +import { API_BASE_URL } from "./client"; import type { ConfirmReceptionResponse, CheckoutCartResponse, @@ -12,7 +13,7 @@ import type { import { getToken } from "../auth/tokenStorage"; import { extractUsernameFromToken } from "../auth/jwtUtils"; -const V1 = "https://mln-uber.club/api/v1"; +const V1 = `${API_BASE_URL}/api/v1`; export const getJwtUsername = async (): Promise => { const token = await getToken(); @@ -901,7 +902,11 @@ export const get2FAStatus = async (): Promise<{ const { data } = await apiClient.get(`${V1}/two-fa/status`); return data; } catch { - return { two_fa_enabled: false, telegram_linked: false, admin_2fa_enabled: false }; + return { + two_fa_enabled: false, + telegram_linked: false, + admin_2fa_enabled: false, + }; } }; @@ -909,7 +914,9 @@ export const toggle2FA = async ( enabled: boolean, ): Promise<{ success: boolean; error?: string }> => { try { - const { data } = await apiClient.post(`${V1}/two-fa/toggle`, { enabled }); + const { data } = await apiClient.post(`${V1}/two-fa/toggle`, { + enabled, + }); return { success: data.success ?? true }; } catch (e: any) { return { success: false, error: e?.response?.data?.error || "Erreur" }; diff --git a/mobile/src/api/client.ts b/mobile/src/api/client.ts index 9b25dc01..ec82a73d 100644 --- a/mobile/src/api/client.ts +++ b/mobile/src/api/client.ts @@ -2,7 +2,8 @@ import axios from "axios"; import { getToken, getAdminToken } from "../auth/tokenStorage"; // Change this to your server IP/domain -export const API_BASE_URL = "https://mln-uber.club"; +export const API_BASE_URL = + process.env.EXPO_PUBLIC_API_URL ?? "https://mln-uber.club"; const apiClient = axios.create({ baseURL: API_BASE_URL,