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:
@@ -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);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user