Added basic locations page to easily move spools between locations
This commit is contained in:
18
client/src/pages/locations/functions.ts
Normal file
18
client/src/pages/locations/functions.ts
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user