Client: Support spool archiving in frontend

This commit is contained in:
Donkie
2023-07-14 14:21:47 +02:00
parent f89cf8ecd4
commit 7971cda7b5
7 changed files with 150 additions and 8 deletions

View File

@@ -0,0 +1,17 @@
import { ISpool } from "./model";
export async function setSpoolArchived(spool: ISpool, archived: boolean) {
const apiEndpoint = import.meta.env.VITE_APIURL;
const init: RequestInit = {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
archived: archived,
}),
};
const request = new Request(apiEndpoint + "/spool/" + spool.id);
await fetch(request, init);
}