Added basic locations page to easily move spools between locations

This commit is contained in:
Donkie
2024-11-19 21:49:29 +01:00
parent 502ea1ba8b
commit a4355967d0
6 changed files with 295 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import { getAPIURL } from "../../utils/url";
import { ISpool } from "../spools/model";
export async function setSpoolLocation(spool_id: number, location: string | null): Promise<ISpool> {
const response = await fetch(getAPIURL() + "/spool/" + spool_id, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
location: location,
}),
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
}