Skip to content

Commit 393118f

Browse files
authored
Merge pull request #16249 from snipe/flatten_api_return
Return flat JSON instead of transformed data
2 parents ff1157a + d3210c6 commit 393118f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/Http/Controllers/Api/AssetsController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,13 @@ public function update(UpdateAssetRequest $request, Asset $asset): JsonResponse
765765
}
766766

767767
if ($problems_updating_encrypted_custom_fields) {
768-
return response()->json(Helper::formatStandardApiResponse('success', (new AssetsTransformer)->transformAsset($asset), trans('admin/hardware/message.update.encrypted_warning')));
768+
return response()->json(Helper::formatStandardApiResponse('success', $asset, trans('admin/hardware/message.update.encrypted_warning')));
769+
// Below is the *correct* return since it uses the transformer, but we have to use the old, flat return for now until we can update Jamf2Snipe and Kanji2Snipe
770+
// return response()->json(Helper::formatStandardApiResponse('success', (new AssetsTransformer)->transformAsset($asset), trans('admin/hardware/message.update.encrypted_warning')));
769771
} else {
770-
return response()->json(Helper::formatStandardApiResponse('success', (new AssetsTransformer)->transformAsset($asset), trans('admin/hardware/message.update.success')));
772+
return response()->json(Helper::formatStandardApiResponse('success', $asset, trans('admin/hardware/message.update.success')));
773+
// Below is the *correct* return since it uses the transformer, but we have to use the old, flat return for now until we can update Jamf2Snipe and Kanji2Snipe
774+
/// return response()->json(Helper::formatStandardApiResponse('success', (new AssetsTransformer)->transformAsset($asset), trans('admin/hardware/message.update.success')));
771775
}
772776
}
773777
return response()->json(Helper::formatStandardApiResponse('error', null, $asset->getErrors()), 200);

0 commit comments

Comments
 (0)