2019-02-21 13:10:53 +00:00
|
|
|
import Controller from '@ember/controller';
|
2020-04-08 09:56:36 +00:00
|
|
|
import { get } from '@ember/object';
|
2019-03-22 17:24:40 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2019-02-21 13:10:53 +00:00
|
|
|
|
2020-06-17 13:19:50 +00:00
|
|
|
export default Controller.extend({
|
2019-03-22 17:24:40 +00:00
|
|
|
notify: service('flashMessages'),
|
2020-06-17 13:19:50 +00:00
|
|
|
actions: {
|
|
|
|
error: function(e) {
|
|
|
|
if (e.target.readyState === 1) {
|
|
|
|
// OPEN
|
|
|
|
if (get(e, 'error.errors.firstObject.status') === '404') {
|
|
|
|
this.notify.add({
|
|
|
|
destroyOnClick: false,
|
|
|
|
sticky: true,
|
|
|
|
type: 'warning',
|
|
|
|
action: 'update',
|
|
|
|
});
|
|
|
|
[e.target, this.proxy].forEach(function(item) {
|
|
|
|
if (item && typeof item.close === 'function') {
|
|
|
|
item.close();
|
|
|
|
}
|
|
|
|
});
|
2019-04-17 08:21:54 +00:00
|
|
|
}
|
2019-03-22 17:24:40 +00:00
|
|
|
}
|
2020-06-17 13:19:50 +00:00
|
|
|
},
|
|
|
|
},
|
2019-02-21 13:10:53 +00:00
|
|
|
});
|