mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-14 11:33:49 +00:00
feat(#29): Remove checkout button when not signed in
This commit is contained in:
@@ -3,6 +3,10 @@
|
|||||||
import { basket, type Basket, type Item } from '$lib/stores/basket.js';
|
import { basket, type Basket, type Item } from '$lib/stores/basket.js';
|
||||||
import BasketItem from '$lib/components/checkout/BasketItem.svelte';
|
import BasketItem from '$lib/components/checkout/BasketItem.svelte';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
let { supabase, session, url } = data;
|
||||||
|
$: ({ supabase, session, url } = data);
|
||||||
|
|
||||||
let localBasket: Basket;
|
let localBasket: Basket;
|
||||||
const unsubscribe = basket.subscribe((value) => {
|
const unsubscribe = basket.subscribe((value) => {
|
||||||
localBasket = value;
|
localBasket = value;
|
||||||
@@ -101,28 +105,32 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<button
|
{#if session?.user !== undefined}
|
||||||
type="submit"
|
<button
|
||||||
class="btn btn-primary"
|
type="submit"
|
||||||
disabled={localBasket.items && localBasket.items.length === 0}
|
class="btn btn-primary"
|
||||||
>Continue to Payment
|
disabled={localBasket.items && localBasket.items.length === 0}
|
||||||
<svg
|
>Continue to Payment
|
||||||
class="ml-2"
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
class="ml-2"
|
||||||
width="23"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
height="22"
|
width="23"
|
||||||
viewBox="0 0 23 22"
|
height="22"
|
||||||
fill="none"
|
viewBox="0 0 23 22"
|
||||||
>
|
fill="none"
|
||||||
<path
|
>
|
||||||
d="M8.75324 5.49609L14.2535 10.9963L8.75 16.4998"
|
<path
|
||||||
stroke="white"
|
d="M8.75324 5.49609L14.2535 10.9963L8.75 16.4998"
|
||||||
stroke-width="1.6"
|
stroke="white"
|
||||||
stroke-linecap="round"
|
stroke-width="1.6"
|
||||||
stroke-linejoin="round"
|
stroke-linecap="round"
|
||||||
/>
|
stroke-linejoin="round"
|
||||||
</svg>
|
/>
|
||||||
</button>
|
</svg>
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<p>You must sign in to checkout</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user