From 0b111418110ca8f6cc8d2a17f0306c51216f6d7c Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 18:21:14 +0200 Subject: [PATCH] Add register function for $lib/api.ts --- src/lib/api.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/api.ts b/src/lib/api.ts index 413c990..d5cc5d8 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -134,6 +134,13 @@ export async function login(username: string, password: string, cookies?: Cookie }, cookies); } +export async function register(username: string, password: string, cookies?: Cookies): Promise { + return apiFetch('/user/register', { + method: 'POST', + body: JSON.stringify({ username, password }), + }, cookies); +} + // Get user data function with type annotation for the response export async function getUserData(token: string): Promise { return apiFetch('/user/me', {