mirror of
https://github.com/usetrmnl/larapaper.git
synced 2026-08-13 14:28:54 -07:00
fix: wrap plugin_settings index response in data key for trmnlp compatibility
The trmnlp APIClient unwraps a 'data' key from the response body, but
PluginSettingsController#index was returning a bare JSON array, causing
`trmnlp list` to always show "No plugins found." Update the controller
and corresponding test to use the `{'data': [...]}` envelope.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Benjamin Nussbaum
co-authored by
Claude Sonnet 4.6
parent
7b7bee1dfa
commit
2b06fd4970
@@ -45,3 +45,6 @@ yarn-error.log
|
||||
/.github/skills
|
||||
/docs/site
|
||||
/docs/node_modules
|
||||
/.envrc
|
||||
/.direnv
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class PluginSettingsController extends Controller
|
||||
'plugin_id' => null,
|
||||
]);
|
||||
|
||||
return response()->json($plugins);
|
||||
return response()->json(['data' => $plugins]);
|
||||
}
|
||||
|
||||
public function store(Request $request): JsonResponse
|
||||
|
||||
@@ -33,7 +33,7 @@ it('GET /api/plugin_settings returns all user plugins with null plugin_id', func
|
||||
$response = $this->getJson('/api/plugin_settings');
|
||||
|
||||
$response->assertOk();
|
||||
$data = $response->json();
|
||||
$data = $response->json('data');
|
||||
expect($data)->toHaveCount(2);
|
||||
expect($data[0])->toMatchArray(['id' => 'uuid-1', 'name' => 'Alpha', 'plugin_id' => null]);
|
||||
expect($data[1])->toMatchArray(['id' => 'uuid-2', 'name' => 'Beta', 'plugin_id' => null]);
|
||||
|
||||
Reference in New Issue
Block a user