[Fix]: Update location when linking/unlinking to/from Spoolman (#669)

* Enhance link spool functionality with additional printer and AMS details

* Refactor linkSpool function to accept detailed context object for improved spooling integration

* Enhance LinkSpoolModal to include amsName in props and linkSpool mutation for improved functionality

* Add amsName prop to PrinterCard for enhanced spool linking functionality

* Updates LinkSpoolModal test to work with recent spool location update changes

* Adds clear_location to unlink testing

* Refactor LinkSpoolRequest to remove ams_name and update location generation logic for improved clarity

* Remove amsName from LinkSpoolModal and PrinterCard for cleaner API integration

* Remove amsName from LinkSpoolModal test props and update linkSpool mock response for improved clarity
This commit is contained in:
Dakota G
2026-03-11 09:38:14 +01:00
committed by GitHub
parent 253828c2b5
commit be2ddbee5d
5 changed files with 49 additions and 8 deletions
+15 -2
View File
@@ -3527,10 +3527,23 @@ export const api = {
request<UnlinkedSpool[]>('/spoolman/spools/unlinked'),
getLinkedSpools: () =>
request<LinkedSpoolsMap>('/spoolman/spools/linked'),
linkSpool: (spoolId: number, spoolTag: string) =>
linkSpool: (
spoolId: number,
context: {
spoolTag: string;
printerId: number;
amsId: number;
trayId: number;
}
) =>
request<{ success: boolean; message: string }>(`/spoolman/spools/${spoolId}/link`, {
method: 'POST',
body: JSON.stringify({ spool_tag: spoolTag }),
body: JSON.stringify({
spool_tag: context.spoolTag,
printer_id: context.printerId,
ams_id: context.amsId,
tray_id: context.trayId,
}),
}),
unlinkSpool: (spoolId: number) =>
request<{ success: boolean; message: string }>(`/spoolman/spools/${spoolId}/unlink`, {