feat: add custom organization logo feature

This commit is contained in:
swve 2023-06-19 00:19:02 +02:00
parent 8c058db5c6
commit 91cb5740ef
16 changed files with 396 additions and 140 deletions

View file

@ -1,5 +1,5 @@
import { getAPIUrl } from "@services/config/config";
import { RequestBody, errorHandling } from "@services/utils/ts/requests";
import { RequestBody, errorHandling, RequestBodyForm } from "@services/utils/ts/requests";
/*
This file includes only POST, PUT, DELETE requests
@ -11,3 +11,12 @@ export async function updateOrganization(org_id: string, data: any) {
const res = await errorHandling(result);
return res;
}
export async function uploadOrganizationLogo(org_id: string, logo_file: any) {
// Send file thumbnail as form data
const formData = new FormData();
formData.append("logo_file", logo_file);
const result: any = await fetch(`${getAPIUrl()}orgs/` + org_id + "/logo", RequestBodyForm("PUT", formData, null));
const res = await errorHandling(result);
return res;
}