diff options
| author | MohamedBassem <me@mbassem.com> | 2024-02-07 18:12:53 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-02-07 18:12:53 +0000 |
| commit | 3745443c2b27afb833be7bcc2f3b4f486a42a571 (patch) | |
| tree | 88f0a90fb100b56ad9e9f4686a1f72c50ba7d5a9 /web/lib/api.ts | |
| parent | 293869e1743c925519d938ebeeff033c773a1ec6 (diff) | |
| download | karakeep-3745443c2b27afb833be7bcc2f3b4f486a42a571.tar.zst | |
[feature] Add support for deleting links
Diffstat (limited to 'web/lib/api.ts')
| -rw-r--r-- | web/lib/api.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/lib/api.ts b/web/lib/api.ts index 193d9bb7..12ce9464 100644 --- a/web/lib/api.ts +++ b/web/lib/api.ts @@ -35,8 +35,8 @@ async function doRequest<T>( opts?: RequestInit, ): Promise< | (InputSchema<T> extends ZodTypeAny - ? [z.infer<InputSchema<T>>, undefined] - : [undefined, undefined]) + ? [z.infer<InputSchema<T>>, undefined] + : [undefined, undefined]) | [undefined, FetchError] > { try { @@ -84,4 +84,10 @@ export default class APIClient { body: JSON.stringify(body), }); } + + static async unbookmarkLink(linkId: string) { + return await doRequest(`/links/${linkId}`, undefined, { + method: "DELETE", + }); + } } |
