fix: Fix policy document format to send as object instead of double-stringified JSON
- Change generatePolicyFromTemplate to return object instead of string - Update CreatePolicyRequest interface to accept string | object for policy - Update CreatePolicyDialog to stringify policy object only when needed - Fix QuickStartWizard to send policy object directly to API This fixes the 'Proxy error' when creating policies as the backend was receiving double-stringified JSON which failed validation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,7 @@ const CreatePolicyDialog: React.FC<CreatePolicyDialogProps> = ({
|
||||
const generatePreview = () => {
|
||||
if (bucketName && selectedTemplate) {
|
||||
const generatedPolicy = policyService.generatePolicyFromTemplate(selectedTemplate, bucketName);
|
||||
setCustomPolicy(generatedPolicy);
|
||||
setCustomPolicy(JSON.stringify(generatedPolicy, null, 2));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ const CreatePolicyDialog: React.FC<CreatePolicyDialogProps> = ({
|
||||
setError('Bucket name is required');
|
||||
return;
|
||||
}
|
||||
policyToCreate = policyService.generatePolicyFromTemplate(selectedTemplate, bucketName);
|
||||
policyToCreate = JSON.stringify(policyService.generatePolicyFromTemplate(selectedTemplate, bucketName), null, 2);
|
||||
}
|
||||
|
||||
if (!validatePolicy()) {
|
||||
|
||||
Reference in New Issue
Block a user