open-vault/ui/app/components/message-error.js
Matthew Irish 4b885c080c
Ui request forwarding error (#4275)
* add ember-cli-content-security-policy
* only enable client side CSP when not in production - the go side handles this otherwise
* add service that handles and stores CSP violations via the securitypolicyviolation event
* update auth form component to show a specialized message when there's a CSP error
* move to computed prop for showing the CSP error message
* fix typos
2018-04-05 16:36:33 -05:00

32 lines
674 B
JavaScript

import Ember from 'ember';
export default Ember.Component.extend({
model: null,
errors: [],
errorMessage: null,
displayErrors: Ember.computed(
'errorMessage',
'model.isError',
'model.adapterError.errors.@each',
'errors',
'errors.@each',
function() {
const errorMessage = this.get('errorMessage');
const errors = this.get('errors');
const modelIsError = this.get('model.isError');
if (errorMessage) {
return [errorMessage];
}
if (errors && errors.length > 0) {
return errors;
}
if (modelIsError) {
return this.get('model.adapterError.errors');
}
}
),
});