3 Commits

Author SHA1 Message Date
balvarez
2df974371c Merge branch 'release/1.1.2'
All checks were successful
DitesLeEnChanson/site/pipeline/tag This commit looks good
2026-01-03 21:31:42 +01:00
balvarez
31bdef2407 version 1.1.2 2026-01-03 21:31:30 +01:00
balvarez
f0109b703a adaptation api 2026-01-03 21:31:03 +01:00
4 changed files with 6 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "web-app",
"type": "module",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"scripts": {
"dev": "vite --host :: --port 3000",

View File

@@ -87,13 +87,14 @@ export const api = {
/**
* Confirme une commande et envoie les emails
*/
async confirmOrder(orderData, sessionId) {
async confirmOrder(orderData, sessionId, orderId = null) {
try {
const data = await apiRequest('/orders/confirm', {
method: 'POST',
body: {
orderData,
sessionId,
orderId,
},
});
return { data, error: null };

View File

@@ -11,6 +11,7 @@ import React, { useEffect, useState } from 'react';
const [orderDetails, setOrderDetails] = useState(null);
const [searchParams] = useSearchParams();
const sessionId = searchParams.get('session_id');
const orderId = searchParams.get('order_id');
const { toast } = useToast();
const [isLoading, setIsLoading] = useState(true);
const [mainStatus, setMainStatus] = useState({ type: 'info', message: 'Traitement en cours...' });
@@ -77,7 +78,7 @@ import React, { useEffect, useState } from 'react';
sessionStorage.setItem(processedKey, 'true');
try {
const { data: functionResponse, error: functionError } = await api.orders.confirmOrder(orderDataForDB, sessionId);
const { data: functionResponse, error: functionError } = await api.orders.confirmOrder(orderDataForDB, sessionId, orderId);
if (functionError) {
console.error("API error:", functionError);

View File

@@ -182,7 +182,7 @@ const OrderPage = () => {
orderData: orderDataForDB,
quantity: 1,
customerEmail: formData.email,
successUrl: `${window.location.origin}/confirmation?session_id={CHECKOUT_SESSION_ID}`,
successUrl: `${window.location.origin}/confirmation`,
cancelUrl: `${window.location.origin}/commander`,
});