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 <[email protected]>
This commit is contained in:
@@ -111,7 +111,10 @@ class PolicyService {
|
|||||||
|
|
||||||
async createPolicy(policyData: CreatePolicyRequest): Promise<void> {
|
async createPolicy(policyData: CreatePolicyRequest): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await axios.post(`${this.baseURL}/policies`, policyData, {
|
await axios.post(`${this.baseURL}/policies`, {
|
||||||
|
policyName: policyData.name,
|
||||||
|
policyDocument: policyData.policy,
|
||||||
|
}, {
|
||||||
headers: getAuthHeaders(),
|
headers: getAuthHeaders(),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -151,7 +154,9 @@ class PolicyService {
|
|||||||
|
|
||||||
async attachPolicy(data: AttachPolicyRequest): Promise<void> {
|
async attachPolicy(data: AttachPolicyRequest): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await axios.post(`${this.baseURL}/policies/attach`, data, {
|
await axios.post(`${this.baseURL}/policies/${data.policyName}/attach`, {
|
||||||
|
username: data.userName,
|
||||||
|
}, {
|
||||||
headers: getAuthHeaders(),
|
headers: getAuthHeaders(),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user