chore: build
This commit is contained in:
@@ -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 = "/api/v1";
|
||||
const V1 = `${API_BASE_URL}/api/v1`;
|
||||
|
||||
export const getJwtUsername = async (): Promise<string | null> => {
|
||||
const token = await getToken();
|
||||
@@ -359,19 +360,18 @@ export const checkoutCart = async (
|
||||
price_currency: data.price_currency,
|
||||
};
|
||||
} catch (error: any) {
|
||||
const errMsg: string = error.response?.data?.error || "Erreur serveur";
|
||||
if (errMsg.startsWith("Adresse invalide ")) {
|
||||
const suggested = errMsg.replace("Adresse invalide ", "").trim();
|
||||
const data = error.response?.data;
|
||||
if (data?.corrected_address) {
|
||||
return {
|
||||
success: false,
|
||||
invalid_address: true,
|
||||
suggested_address: suggested,
|
||||
message: errMsg,
|
||||
suggested_address: data.corrected_address,
|
||||
message: data.error || "Adresse non reconnue",
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: false,
|
||||
message: errMsg,
|
||||
message: data?.error || "Erreur serveur",
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -529,7 +529,6 @@ export const getOrdersWithTracking = async () => {
|
||||
|
||||
// ============================================
|
||||
// HISTORY
|
||||
// ============================================
|
||||
|
||||
export const getMyCompletedOrders = async (): Promise<HistoryResponse> => {
|
||||
try {
|
||||
@@ -661,6 +660,7 @@ export const updateMyProfile = async (fields: {
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// ORDER DETAILS
|
||||
// ============================================
|
||||
|
||||
@@ -963,6 +963,7 @@ export const toggle2FA = async (
|
||||
|
||||
export type RewardCategoryConfig = {
|
||||
category: string;
|
||||
type: "free_product" | "half_price_product";
|
||||
all_products: boolean;
|
||||
product_ids: number[];
|
||||
product_names: string[];
|
||||
@@ -974,6 +975,7 @@ export type RewardItemConfig = {
|
||||
product_name: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
type: "free_product" | "half_price_product";
|
||||
};
|
||||
|
||||
export type PointsPoolInfo = {
|
||||
@@ -989,7 +991,6 @@ export type PointsPoolInfo = {
|
||||
|
||||
export type PointsRewardConfig = {
|
||||
threshold: number;
|
||||
type: string;
|
||||
description: string;
|
||||
reward_items: RewardItemConfig[];
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface ApiResponse {
|
||||
token_type?: string;
|
||||
expires_in?: number;
|
||||
user?: UserResponse;
|
||||
[key: string]: any;
|
||||
[key: string]: any; // Pour les champs additionnels
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user