chore: Show error messages from server in agent APIs (#4055)
This commit is contained in:
@@ -127,11 +127,16 @@ export default {
|
|||||||
this.showAlert(this.$t('AGENT_MGMT.ADD.API.SUCCESS_MESSAGE'));
|
this.showAlert(this.$t('AGENT_MGMT.ADD.API.SUCCESS_MESSAGE'));
|
||||||
this.onClose();
|
this.onClose();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const {
|
||||||
|
response: { data: { error: errorResponse = '' } = {} } = {},
|
||||||
|
} = error;
|
||||||
|
let errorMessage = '';
|
||||||
if (error.response.status === 422) {
|
if (error.response.status === 422) {
|
||||||
this.showAlert(this.$t('AGENT_MGMT.ADD.API.EXIST_MESSAGE'));
|
errorMessage = this.$t('AGENT_MGMT.ADD.API.EXIST_MESSAGE');
|
||||||
} else {
|
} else {
|
||||||
this.showAlert(this.$t('AGENT_MGMT.ADD.API.ERROR_MESSAGE'));
|
errorMessage = this.$t('AGENT_MGMT.ADD.API.ERROR_MESSAGE');
|
||||||
}
|
}
|
||||||
|
this.showAlert(errorResponse || errorMessage);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user