From f02d1c8890d1b2c55dc467b71e616d12d202d17c Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 23 Jul 2025 17:43:26 +0200 Subject: [PATCH] fix: Fix policy creation API field mapping to match backend expectations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update createPolicy to send 'policyName' and 'policyDocument' fields - Update attachPolicy to use correct endpoint format /policies/{name}/attach - Send 'username' field in attachPolicy request body This fixes the 'Validation Error' when creating policies in QuickStartWizard and ensures policies are created and attached correctly to users. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- frontend/src/services/policyService.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/services/policyService.ts b/frontend/src/services/policyService.ts index 4d94427..f8a6783 100644 --- a/frontend/src/services/policyService.ts +++ b/frontend/src/services/policyService.ts @@ -111,7 +111,10 @@ class PolicyService { async createPolicy(policyData: CreatePolicyRequest): Promise { try { - await axios.post(`${this.baseURL}/policies`, policyData, { + await axios.post(`${this.baseURL}/policies`, { + policyName: policyData.name, + policyDocument: policyData.policy, + }, { headers: getAuthHeaders(), }); } catch (error) { @@ -151,7 +154,9 @@ class PolicyService { async attachPolicy(data: AttachPolicyRequest): Promise { try { - await axios.post(`${this.baseURL}/policies/attach`, data, { + await axios.post(`${this.baseURL}/policies/${data.policyName}/attach`, { + username: data.userName, + }, { headers: getAuthHeaders(), }); } catch (error) {