diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-10-20 14:29:11 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-10-20 14:29:11 +0000 |
| commit | 719e25d8254fd9ab2516f5faf6d2f07af4257792 (patch) | |
| tree | c44a68323b41fd465ddad754f28d91d38ba9c682 /apps/web/app/api/v1/utils/handler.ts | |
| parent | 62395ecbbfef38686073369443d99249421b2e22 (diff) | |
| download | karakeep-719e25d8254fd9ab2516f5faf6d2f07af4257792.tar.zst | |
feature: Add DELETE REST APIs for bookmarks, lists and tags
Diffstat (limited to 'apps/web/app/api/v1/utils/handler.ts')
| -rw-r--r-- | apps/web/app/api/v1/utils/handler.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/web/app/api/v1/utils/handler.ts b/apps/web/app/api/v1/utils/handler.ts index d66bb299..d5f470df 100644 --- a/apps/web/app/api/v1/utils/handler.ts +++ b/apps/web/app/api/v1/utils/handler.ts @@ -81,7 +81,7 @@ export async function buildHandler< bodySchema, }: { req: NextRequest; - handler: (req: InputT) => Promise<{ status: number; resp: object }>; + handler: (req: InputT) => Promise<{ status: number; resp?: object }>; searchParamsSchema?: SearchParamsT | undefined; bodySchema?: BodyT | undefined; }) { @@ -108,7 +108,7 @@ export async function buildHandler< body, } as InputT); - return new Response(JSON.stringify(resp), { + return new Response(resp ? JSON.stringify(resp) : null, { status, headers: { "Content-Type": "application/json", |
