2020-07-09 09:08:47 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { set } from '@ember/object';
|
|
|
|
import Slotted from 'block-slots';
|
|
|
|
import chart from './chart.xstate';
|
|
|
|
|
|
|
|
export default Component.extend(Slotted, {
|
|
|
|
tagName: '',
|
|
|
|
ondelete: function() {
|
|
|
|
return this.onchange(...arguments);
|
|
|
|
},
|
|
|
|
onchange: function() {},
|
|
|
|
init: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.chart = chart;
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
persist: function(data, e) {
|
|
|
|
if (e && typeof e.preventDefault === 'function') {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
set(this, 'data', data);
|
|
|
|
this.dispatch('PERSIST');
|
|
|
|
},
|
2022-08-08 09:51:02 +00:00
|
|
|
error: function(data, e) {
|
|
|
|
if (e && typeof e.preventDefault === 'function') {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
set(
|
|
|
|
this,
|
|
|
|
'error',
|
|
|
|
typeof data.error.errors !== 'undefined' ?
|
|
|
|
data.error.errors.firstObject : data.error
|
|
|
|
);
|
|
|
|
this.dispatch('ERROR');
|
|
|
|
},
|
2020-07-09 09:08:47 +00:00
|
|
|
},
|
|
|
|
});
|