🚧 Migrate to new SvelteKit routing system
A bit annoying but for the best I guess?
This commit is contained in:
@@ -27,30 +27,27 @@
|
||||
})
|
||||
if (existantCart.ok) {
|
||||
const cart = await existantCart.json()
|
||||
// console.log('Fetched existant cart:', $cartId, $cartData)
|
||||
|
||||
// Cart is active / has not been ordered
|
||||
if (cart.active || !cart.order_id) {
|
||||
// Keep current cart
|
||||
$cartId = cart.id
|
||||
$cartData = cart
|
||||
return
|
||||
}
|
||||
|
||||
// Cart is inactive / has been ordered
|
||||
else {
|
||||
// Fetch a new cart
|
||||
const newCart = await fetch('/api/swell', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
action: 'createCart'
|
||||
})
|
||||
const newCart = await fetch('/api/swell', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
action: 'createCart'
|
||||
})
|
||||
if (newCart.ok) {
|
||||
const cart = await newCart.json()
|
||||
// Save new cart
|
||||
$cartId = cart.id
|
||||
$cartData = cart
|
||||
}
|
||||
})
|
||||
if (newCart.ok) {
|
||||
const cart = await newCart.json()
|
||||
// Save new cart
|
||||
$cartId = cart.id
|
||||
$cartData = cart
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user