Added ability to rename location

This commit is contained in:
Donkie
2024-11-20 21:00:39 +01:00
parent 5861190821
commit 37b6d1fcee
5 changed files with 103 additions and 5 deletions

View File

@@ -33,3 +33,19 @@ export function useLocations(): string[] {
}
}, [query.data]);
}
export async function renameSpoolLocation(location: string, newName: string): Promise<string> {
const response = await fetch(getAPIURL() + "/location/" + location, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: newName,
}),
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
return await response.text();
}