Make sure values from api are correct

[MAILPOET-2453]
This commit is contained in:
Pavel Dohnal
2019-12-16 15:15:30 +01:00
committed by Rostislav Wolný
parent 05b93da9b2
commit 185566460b
3 changed files with 6 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ const CustomFieldSettings = ({
customFieldId,
data: {
params: {
required: '1',
required: localMandatory ? '1' : undefined,
validate: localValidate,
},
},

View File

@@ -24,8 +24,8 @@ class CustomFieldsResponseBuilder {
'name' => $custom_field->getName(),
'type' => $custom_field->getType(),
'params' => $custom_field->getParams(),
'created_at' => $custom_field->getCreatedAt()->format(DATE_ATOM),
'updated_at' => $custom_field->getUpdatedAt()->format(DATE_ATOM),
'created_at' => $custom_field->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $custom_field->getUpdatedAt()->format('Y-m-d H:i:s'),
];
}
}

View File

@@ -45,7 +45,9 @@ class CustomFields extends APIEndpoint {
}
$custom_field = CustomField::findOne($custom_field->id);
if(!$custom_field instanceof CustomField) return $this->errorResponse();
return $this->successResponse($custom_field->asArray());
$response = $custom_field->asArray();
$response['id'] = (int)$response['id'];
return $this->successResponse($response);
}
function get($data = []) {