Client: Support spool archiving in frontend
This commit is contained in:
17
client/src/pages/spools/functions.ts
Normal file
17
client/src/pages/spools/functions.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user