Fix quantity sent as string when saving an asset
submitAssetForm() converted item_type_id/folder_id/status_id/ assigned_user_id from FormData's string values to numbers before JSON-encoding the payload, but missed quantity, so it stayed a string and the server's json.Decode into assetRequest.Quantity (int) rejected it as "cannot unmarshal string into Go struct field".
This commit is contained in:
@@ -713,6 +713,8 @@
|
||||
payload.status_id = Number(value);
|
||||
} else if (key === 'assigned_user_id') {
|
||||
payload.assigned_user_id = value ? Number(value) : null;
|
||||
} else if (key === 'quantity') {
|
||||
payload.quantity = Number(value) || 0;
|
||||
} else {
|
||||
payload[key] = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user