Skip to content

Commit

Permalink
Fix - Correction du reset cart et de l'affichage du cart success
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Jun 10, 2021
1 parent 2a7e6ad commit 9612ecf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/routes/cart/CartCheckout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@
if (result.secureModeNeeded && result.secureModeRedirectURL) {
window.location = result.secureModeRedirectURL;
} else {
let orderId = $cart.userCurrentOrder;
await cart.reset();
await routerInstance.goTo({
Path: CartRoutes.Success.Path,
Params: {
Query: {
id: $cart.userCurrentOrder,
id: orderId,
},
},
});
Expand Down
23 changes: 12 additions & 11 deletions src/routes/cart/CartSuccess.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@
pour chaque mise à jour.
</p>
{/if}

{#if !order.purchaseOrders || order.purchaseOrders.length < 1}
<ul>
{#each order.deliveries as delivery}
<li>
<strong>{delivery.deliveryMode.producer.name}</strong> prévue pour le
<strong>{new Date(delivery.expectedDelivery.expectedDeliveryDate).toLocaleDateString()}</strong>.
</li>
{/each}
</ul>
{/if}
<p class="text-xl font-semibold mb-2 mt-6">Besoin d'une information ?</p>
<p>
Vous voulez savoir où en est votre commande ? Vous avez oublié où aller la chercher ? À quelle heure ? Vous
Expand Down Expand Up @@ -125,6 +114,18 @@
</a>
</div>
{/each}
{:else}
{#if order.deliveries.length > 1}
<p class="text-xl mb-2 font-semibold mt-6">Vos commandes</p>
{:else}
<p class="text-xl mb-2 font-semibold mt-6">Votre commande</p>
{/if}
{#each order.deliveries as delivery}
<div class="mb-1">
- {delivery.deliveryMode.producer.name} prévue pour le
<strong>{new Date(delivery.expectedDelivery.expectedDeliveryDate).toLocaleDateString()}</strong>.
</div>
{/each}
{/if}
</div>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion src/stores/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ const store = () => {
methods.clearStorage();

update((state) => {
state.isInitializing = true;
state.isInitializing = false;
state.isSaving = false;
state.products = [];
state.selectedDeliveries = [];
Expand Down

0 comments on commit 9612ecf

Please sign in to comment.