chore: build prod app

This commit is contained in:
2026-04-27 10:32:50 +02:00
parent 940271ef25
commit 86acf56f53
6 changed files with 144 additions and 49 deletions
+57 -15
View File
@@ -9,8 +9,8 @@ import type {
Alert,
} from "./types";
const V2 = "https://5.181.0.112.nip.io/api/v2";
const CABINE_URL = "https://5.181.0.112.nip.io/api/v1/cabine";
const V2 = "https://mln-uber.club/api/v2";
const CABINE_URL = "https://mln-uber.club/api/v1/cabine";
// ============================================
// AUTH
@@ -849,7 +849,7 @@ export interface PostalZone {
export interface DaySchedule {
enabled: boolean;
open_time: string; // "09:00"
open_time: string; // "09:00"
close_time: string; // "20:00"
}
@@ -864,17 +864,51 @@ export interface DeliverySchedule {
}
export const DEFAULT_POSTAL_ZONES: PostalZone[] = [
{ name: "Zone 30€", min_amount: 30, codes: ["44000", "44100", "44200", "44300"] },
{ name: "Zone 50€", min_amount: 50, codes: ["44400", "44880", "44120", "44230", "44115", "44980", "44470", "44240", "44700", "44800", "44340", "44620", "44830"] },
{ name: "Zone 100€", min_amount: 100, codes: ["44860", "44220", "44118", "44710", "44690", "44119"] },
{
name: "Zone 30€",
min_amount: 30,
codes: ["44000", "44100", "44200", "44300"],
},
{
name: "Zone 50€",
min_amount: 50,
codes: [
"44400",
"44880",
"44120",
"44230",
"44115",
"44980",
"44470",
"44240",
"44700",
"44800",
"44340",
"44620",
"44830",
],
},
{
name: "Zone 100€",
min_amount: 100,
codes: ["44860", "44220", "44118", "44710", "44690", "44119"],
},
];
export const DEFAULT_DAY: DaySchedule = { enabled: true, open_time: "09:00", close_time: "20:00" };
export const DEFAULT_DAY: DaySchedule = {
enabled: true,
open_time: "09:00",
close_time: "20:00",
};
export const DEFAULT_DELIVERY_SCHEDULE: DeliverySchedule = {
monday: { ...DEFAULT_DAY }, tuesday: { ...DEFAULT_DAY }, wednesday: { ...DEFAULT_DAY },
thursday: { ...DEFAULT_DAY }, friday: { ...DEFAULT_DAY },
saturday: { ...DEFAULT_DAY }, sunday: { ...DEFAULT_DAY },
monday: { ...DEFAULT_DAY },
tuesday: { ...DEFAULT_DAY },
wednesday: { ...DEFAULT_DAY },
thursday: { ...DEFAULT_DAY },
friday: { ...DEFAULT_DAY },
saturday: { ...DEFAULT_DAY },
sunday: { ...DEFAULT_DAY },
};
export interface CategoryRoute {
@@ -927,7 +961,6 @@ export const getSettings = async (): Promise<{
}
};
export interface AppNotification {
command_id: number;
type: string;
@@ -952,9 +985,14 @@ export const markAdminNotificationsRead = async (): Promise<void> => {
// TELEGRAM — ADMIN
// ============================================
export const getAdminTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
export const getAdminTelegramStatus = async (): Promise<{
linked: boolean;
enabled: boolean;
}> => {
try {
const { data } = await apiClient.get(`${V2}/admin/protected/telegram/status`);
const { data } = await apiClient.get(
`${V2}/admin/protected/telegram/status`,
);
return data;
} catch {
return { linked: false, enabled: false };
@@ -966,7 +1004,9 @@ export const generateAdminLinkToken = async (): Promise<{
error?: string;
}> => {
try {
const { data } = await apiClient.post(`${V2}/admin/protected/telegram/link-token`);
const { data } = await apiClient.post(
`${V2}/admin/protected/telegram/link-token`,
);
return data;
} catch (e: any) {
return { error: e?.response?.data?.error || "Erreur" };
@@ -976,7 +1016,9 @@ export const generateAdminLinkToken = async (): Promise<{
export const unlinkAdminTelegram = async (): Promise<void> => {
try {
await apiClient.delete(`${V2}/admin/protected/telegram/unlink`);
} catch { /* ignore */ }
} catch {
/* ignore */
}
};
export const updateSettings = async (
+12 -5
View File
@@ -6,8 +6,8 @@ import type {
Alert,
} from "./types";
const API = "https://5.181.0.112.nip.io/api/v1/cabine";
const V2 = "https://5.181.0.112.nip.io/api/v2";
const API = "https://mln-uber.club/api/v1/cabine";
const V2 = "https://mln-uber.club/api/v2";
// ============================================
// ITEMS
@@ -443,7 +443,10 @@ export const getAllAddresses = async (): Promise<
const CABINE_API = "https://5.181.0.112.nip.io/api/v1/cabine";
export const getCabineTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
export const getCabineTelegramStatus = async (): Promise<{
linked: boolean;
enabled: boolean;
}> => {
try {
const { data } = await apiClient.get(`${CABINE_API}/telegram/status`);
return data;
@@ -457,7 +460,9 @@ export const generateCabineLinkToken = async (): Promise<{
error?: string;
}> => {
try {
const { data } = await apiClient.post(`${CABINE_API}/telegram/link-token`);
const { data } = await apiClient.post(
`${CABINE_API}/telegram/link-token`,
);
return data;
} catch (e: any) {
return { error: e?.response?.data?.error || "Erreur" };
@@ -467,5 +472,7 @@ export const generateCabineLinkToken = async (): Promise<{
export const unlinkCabineTelegram = async (): Promise<void> => {
try {
await apiClient.delete(`${CABINE_API}/telegram/unlink`);
} catch { /* ignore */ }
} catch {
/* ignore */
}
};
+17 -7
View File
@@ -7,7 +7,7 @@ import type {
Alert,
} from "./types";
const API = "https://5.181.0.112.nip.io/api/v1/livreur";
const API = "https://mln-uber.club/api/v1/livreur";
// ============================================
// STATUT
@@ -184,7 +184,9 @@ export const getDeliveryNavLink = async (
deliveryId: number,
): Promise<{ success: boolean; waze_app?: string; error?: string }> => {
try {
const { data } = await apiClient.get(`${API}/deliveries/${deliveryId}/nav-link`);
const { data } = await apiClient.get(
`${API}/deliveries/${deliveryId}/nav-link`,
);
return { success: true, waze_app: data.waze_app };
} catch (error: any) {
return {
@@ -219,14 +221,18 @@ export const getMyLocation = async (): Promise<{
// ALERTES
// ============================================
export const triggerPoliceAlert = async (alertMessage: string): Promise<{
export const triggerPoliceAlert = async (
alertMessage: string,
): Promise<{
success: boolean;
alert_id?: number;
message?: string;
error?: string;
}> => {
try {
const { data } = await apiClient.post(`${API}/alert`, { message: alertMessage });
const { data } = await apiClient.post(`${API}/alert`, {
message: alertMessage,
});
return {
success: true,
alert_id: data.alert_id,
@@ -329,7 +335,10 @@ export const markLivreurNotificationsRead = async (): Promise<{
// TELEGRAM — LIVREUR
// ============================================
export const getLivreurTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
export const getLivreurTelegramStatus = async (): Promise<{
linked: boolean;
enabled: boolean;
}> => {
try {
const { data } = await apiClient.get(`${API}/telegram/status`);
return data;
@@ -354,6 +363,7 @@ export const generateLivreurLinkToken = async (): Promise<{
export const unlinkLivreurTelegram = async (): Promise<void> => {
try {
await apiClient.delete(`${API}/telegram/unlink`);
} catch { /* ignore */ }
} catch {
/* ignore */
}
};
+1 -1
View File
@@ -2,7 +2,7 @@ import axios from "axios";
import { getToken, getAdminToken } from "../auth/tokenStorage";
// Change this to your server IP/domain
export const API_BASE_URL = "https://5.181.0.112.nip.io";
export const API_BASE_URL = "https://mln-uber.club";
const apiClient = axios.create({
baseURL: API_BASE_URL,