fix: Fix policy creation API field mapping to match backend expectations

- 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 <noreply@anthropic.com>
This commit is contained in:
2025-07-23 17:43:26 +02:00
parent 79a9977dbc
commit f02d1c8890
+7 -2
View File
@@ -111,7 +111,10 @@ class PolicyService {
async createPolicy(policyData: CreatePolicyRequest): Promise<void> {
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<void> {
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) {