Add types to Swell route api

This commit is contained in:
2022-06-07 14:55:20 +02:00
parent ce25f9314b
commit bd8c4e590f

View File

@@ -1,3 +1,4 @@
import type { RequestEvent, RequestHandlerOutput } from '@sveltejs/kit'
import { import {
getProducts, getProducts,
getProduct, getProduct,
@@ -10,7 +11,7 @@ import {
// Block GET requests // Block GET requests
export async function get ({ url, body }) { export async function get({}: RequestEvent): Promise<RequestHandlerOutput> {
return { return {
status: 403, status: 403,
body: 'nope!' body: 'nope!'
@@ -21,7 +22,7 @@ export async function get ({ url, body }) {
/** /**
* POST request * POST request
*/ */
export async function post ({ request, params }) { export async function post ({ request }: RequestEvent): Promise<RequestHandlerOutput> {
try { try {
const body = await request.json() const body = await request.json()
const { action, cartId, productId } = body const { action, cartId, productId } = body