chore: Validation for purchased pricing_plan_quantity (#8809)

- Add validations based on purchased pricing_plan_quantity
- Modify the Dashboard to support the new error message
This commit is contained in:
Sojan Jose
2024-01-30 11:26:07 +04:00
committed by GitHub
parent eeb0113dc5
commit 0805f362d3
4 changed files with 64 additions and 4 deletions

View File

@@ -130,15 +130,23 @@ export default {
this.showAlert(this.$t('AGENT_MGMT.ADD.API.SUCCESS_MESSAGE'));
this.onClose();
} catch (error) {
const { response: { data: { error: errorResponse = '' } = {} } = {} } =
error;
const {
response: {
data: {
error: errorResponse = '',
attributes: attributes = [],
message: attrError = '',
} = {},
} = {},
} = error;
let errorMessage = '';
if (error.response.status === 422) {
if (error.response.status === 422 && !attributes.includes('base')) {
errorMessage = this.$t('AGENT_MGMT.ADD.API.EXIST_MESSAGE');
} else {
errorMessage = this.$t('AGENT_MGMT.ADD.API.ERROR_MESSAGE');
}
this.showAlert(errorResponse || errorMessage);
this.showAlert(errorResponse || attrError || errorMessage);
}
},
},