Skip to content

Commit c55e37b

Browse files
committed
refactor: conditionally render order button based on authentication status
1 parent babbfc4 commit c55e37b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

frontend/src/routes/order/cart/+page.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@
6969
{/if}
7070
{/each}
7171
<div class="flex justify-end">
72-
<button class="cursor-pointer bg-blue-400 px-4 py-2" onclick={() => order()}>Order now</button
73-
>
72+
{#if authStore.isValid}
73+
<button class="cursor-pointer bg-blue-400 px-4 py-2" onclick={() => order()}
74+
>Order now</button
75+
>
76+
{:else}
77+
<p class="text-red-400">You need to be logged in to order pets.</p>
78+
{/if}
7479
</div>
7580
</div>
7681
{:catch error}

0 commit comments

Comments
 (0)