Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用typescript在storeon中分派操作_Javascript_Reactjs_Typescript - Fatal编程技术网

Javascript 使用typescript在storeon中分派操作

Javascript 使用typescript在storeon中分派操作,javascript,reactjs,typescript,Javascript,Reactjs,Typescript,我正在编写我的浏览器扩展,并试图将storeon添加到我的代码中。 我不知道如何在调度中纠正写操作; 对于expample,我要分派此函数: getTimeEntryInProgress() { let userId = this.localStorageService.get("userId"); this.timeEntryService .list(userId) .then(response => { let timeEntr

我正在编写我的浏览器扩展,并试图将storeon添加到我的代码中。 我不知道如何在调度中纠正写操作; 对于expample,我要分派此函数:

getTimeEntryInProgress() {
    let userId = this.localStorageService.get("userId");
    this.timeEntryService
      .list(userId)
      .then(response => {
        let timeEntry = response.data.filter(
          x =>
            x.custom_fields[0].value === "false" ||
            x.custom_fields[0].value === "0"
        )[0];
        this.setTimeEntryInProgress(timeEntry);
      })
      .catch(() => {
        this.application.setIcon(IconStatus.TimeEntryEnded);
      });
  }
例如,这是我的商店模块之一:

export const timeEntryModule: Module<TimeEntryState, TimeEntryEvents> = store => {
    store.on('@init', () => ({
        timeEntries: [],
        selectedTimeEntry: null,
        timeEntryInProgress: null
    }));
    store.on('timeEntry/select', (state, selectedTimeEntry) => ({ selectedTimeEntry }));
    store.on('timeEntry/inProgress', (state, timeEntryInProgress) => ({ timeEntryInProgress }));
}
export const timeEntryModule:Module=store=>{
store.on('@init',()=>({
时间项:[],
selectedTimeEntry:null,
timeEntryInProgress:空
}));
store.on('timeEntry/select',(state,selectedTimeEntry)=>({selectedTimeEntry}));
on('timeEntry/inProgress',(state,timeEntryInProgress)=>({timeEntryInProgress}));
}
可能有人能帮忙或提供有用的链接