Added ability to rename location
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user