ttk-app-core
Version:
@ttk/recat enterprise develop framework
35 lines (28 loc) • 887 B
JavaScript
import React from 'react'
import { action as MetaAction, AppLoader } from '@ttk/meta-engine';
import config from './config'
import moment from 'moment'
class action {
constructor(option) {
this.metaAction = option.metaAction
this.config = config.current
this.webapi = this.config.webapi
}
onInit = ({ component, injections }) => {
this.component = component
this.injections = injections
injections.reduce('init')
this.load()
}
load = async () => {
const response = await this.webapi.analysis.query()
this.injections.reduce('load', response)
}
}
export default function creator(option) {
const metaAction = new MetaAction(option),
o = new action({ ...option, metaAction }),
ret = { ...metaAction, ...o }
metaAction.config({ metaHandlers: ret })
return ret
}