🚧 Switch to swell-js to handle Shop cart
swell-node was relying too much on Node packages like crypto or events to be used with Cloudflare Pages or Vercel Edge Functions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { error } from '@sveltejs/kit'
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
import { getProduct } from '$utils/functions/swell'
|
||||
import { getProduct } from '$utils/functions/shop'
|
||||
import { getRandomItem } from '$utils/functions'
|
||||
|
||||
export const load: PageServerLoad = async ({}) => {
|
||||
@@ -36,7 +36,7 @@ export const load: PageServerLoad = async ({}) => {
|
||||
}`)
|
||||
|
||||
if (data) {
|
||||
const randomPoster = getRandomItem(data.data.posters)
|
||||
const randomPoster: any = getRandomItem(data.data.posters)
|
||||
|
||||
// Fetch Swell API for product
|
||||
const shopProduct = await getProduct(randomPoster.product_id)
|
||||
|
||||
Reference in New Issue
Block a user