Add types to Swell route api
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user