feat: cancel user deletion

This commit is contained in:
Sam 2023-03-14 16:16:07 +01:00
parent 1e6eb66168
commit 9bfabcc1f1
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
9 changed files with 169 additions and 9 deletions

View file

@ -3,13 +3,18 @@ import { PUBLIC_BASE_URL } from "$env/static/public";
export async function apiFetch<T>(
path: string,
{ method, body, token }: { method?: string; body?: any; token?: string },
{
method,
body,
token,
headers,
}: { method?: string; body?: any; token?: string; headers?: Record<string, string> },
) {
const resp = await fetch(`${PUBLIC_BASE_URL}/api/v1${path}`, {
method: method || "GET",
headers: {
...(token ? { Authorization: token } : {}),
...(headers ? headers : {}),
"Content-Type": "application/json",
},
body: body ? JSON.stringify(body) : null,