chore: build prod app
This commit is contained in:
+56
-20
@@ -12,7 +12,7 @@ import type {
|
||||
import { getToken } from "../auth/tokenStorage";
|
||||
import { extractUsernameFromToken } from "../auth/jwtUtils";
|
||||
|
||||
const V1 = "https://5.181.0.112.nip.io/api/v1";
|
||||
const V1 = "https://mln-uber.club/api/v1";
|
||||
|
||||
export const getJwtUsername = async (): Promise<string | null> => {
|
||||
const token = await getToken();
|
||||
@@ -350,14 +350,19 @@ export const checkoutCart = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const getReferralBalance = async (): Promise<ReferralBalanceResponse> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/referral/balance`);
|
||||
return { success: true, balance: data.balance ?? 0 };
|
||||
} catch {
|
||||
return { success: false, balance: 0, message: "Erreur récupération solde" };
|
||||
}
|
||||
};
|
||||
export const getReferralBalance =
|
||||
async (): Promise<ReferralBalanceResponse> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/referral/balance`);
|
||||
return { success: true, balance: data.balance ?? 0 };
|
||||
} catch {
|
||||
return {
|
||||
success: false,
|
||||
balance: 0,
|
||||
message: "Erreur récupération solde",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const approveDelivery = async (
|
||||
commandId: number,
|
||||
@@ -606,7 +611,11 @@ export const getMyPenalties = async (): Promise<PenaltiesResponse> => {
|
||||
// 👤 PROFIL CLIENT
|
||||
// ============================================
|
||||
|
||||
export const getMyProfile = async (): Promise<{ success: boolean; client?: any; message?: string }> => {
|
||||
export const getMyProfile = async (): Promise<{
|
||||
success: boolean;
|
||||
client?: any;
|
||||
message?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/profile`);
|
||||
return { success: true, client: data.client };
|
||||
@@ -615,14 +624,21 @@ export const getMyProfile = async (): Promise<{ success: boolean; client?: any;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateMyProfile = async (fields: { nom?: string; prenom?: string; telephone?: string }): Promise<{ success: boolean; message?: string; client?: any }> => {
|
||||
export const updateMyProfile = async (fields: {
|
||||
nom?: string;
|
||||
prenom?: string;
|
||||
telephone?: string;
|
||||
}): Promise<{ success: boolean; message?: string; client?: any }> => {
|
||||
try {
|
||||
const { data } = await apiClient.put(`${V1}/profile/update`, fields);
|
||||
return { success: true, client: data.client, message: data.message };
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
message: error.response?.data?.error || error.response?.data?.message || "Erreur mise à jour profil",
|
||||
message:
|
||||
error.response?.data?.error ||
|
||||
error.response?.data?.message ||
|
||||
"Erreur mise à jour profil",
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -773,7 +789,17 @@ export interface PublicSettings {
|
||||
}
|
||||
|
||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, crypto_only: false, nowpayments_currencies: [] };
|
||||
const defaults: PublicSettings = {
|
||||
penalties_enabled: true,
|
||||
show_amende_score: true,
|
||||
points_enabled: true,
|
||||
points_separated: true,
|
||||
referral_enabled: true,
|
||||
pool_names: ["Pool 1", "Pool 2"],
|
||||
crypto_payment_enabled: false,
|
||||
crypto_only: false,
|
||||
nowpayments_currencies: [],
|
||||
};
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/app-settings`);
|
||||
return {
|
||||
@@ -782,12 +808,15 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
points_enabled: data.points_enabled ?? true,
|
||||
points_separated: data.points_separated ?? true,
|
||||
referral_enabled: data.referral_enabled ?? true,
|
||||
pool_names: Array.isArray(data.pool_names) && data.pool_names.length > 0
|
||||
? data.pool_names
|
||||
: defaults.pool_names,
|
||||
pool_names:
|
||||
Array.isArray(data.pool_names) && data.pool_names.length > 0
|
||||
? data.pool_names
|
||||
: defaults.pool_names,
|
||||
crypto_payment_enabled: data.crypto_payment_enabled ?? false,
|
||||
crypto_only: data.crypto_only ?? false,
|
||||
nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [],
|
||||
nowpayments_currencies: Array.isArray(data.nowpayments_currencies)
|
||||
? data.nowpayments_currencies
|
||||
: [],
|
||||
};
|
||||
} catch {
|
||||
return defaults;
|
||||
@@ -805,9 +834,13 @@ export interface CryptoPaymentStatus {
|
||||
price_currency: string;
|
||||
}
|
||||
|
||||
export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoPaymentStatus | null> => {
|
||||
export const getCryptoPaymentStatus = async (
|
||||
commandId: number,
|
||||
): Promise<CryptoPaymentStatus | null> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/commands/${commandId}/payment-status`);
|
||||
const { data } = await apiClient.get(
|
||||
`${V1}/commands/${commandId}/payment-status`,
|
||||
);
|
||||
return data;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -818,7 +851,10 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoP
|
||||
// TELEGRAM
|
||||
// ============================================
|
||||
|
||||
export const getTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
export const getTelegramStatus = async (): Promise<{
|
||||
linked: boolean;
|
||||
enabled: boolean;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/telegram/status`);
|
||||
return data;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user