Update npm packages and code for newest SvelteKit updates
This commit is contained in:
@@ -21,16 +21,16 @@ export async function get ({ url, body }) {
|
||||
/**
|
||||
* POST request
|
||||
*/
|
||||
export async function post ({ headers, url, body, params, ...rest }) {
|
||||
export async function post ({ request, params }) {
|
||||
try {
|
||||
const bodyParsed = JSON.parse(Buffer.from(body).toString())
|
||||
const { action, cartId, productId } = bodyParsed
|
||||
const body = await request.json()
|
||||
const { action, cartId, productId } = body
|
||||
let result = {}
|
||||
|
||||
if (bodyParsed) {
|
||||
if (body) {
|
||||
switch (action) {
|
||||
case 'getProducts': {
|
||||
result = await getProducts(bodyParsed.category)
|
||||
result = await getProducts(body.category)
|
||||
break
|
||||
}
|
||||
case 'getProduct': {
|
||||
@@ -46,11 +46,11 @@ export async function post ({ headers, url, body, params, ...rest }) {
|
||||
break
|
||||
}
|
||||
case 'addToCart': {
|
||||
result = await addToCart(cartId, productId, bodyParsed.quantity)
|
||||
result = await addToCart(cartId, productId, body.quantity)
|
||||
break
|
||||
}
|
||||
case 'updateCartItem': {
|
||||
result = await updateCartItem(cartId, productId, bodyParsed.quantity)
|
||||
result = await updateCartItem(cartId, productId, body.quantity)
|
||||
break
|
||||
}
|
||||
case 'removeCartItem': {
|
||||
|
||||
Reference in New Issue
Block a user