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