【发布时间】:2020-06-13 09:03:26
【问题描述】:
这可行,但如果可能,我想在链中添加更多操作。
this.store.dispatch(new UploadPendingFiles(pendingFiles));
this.actions$.pipe(ofActionSuccessful(UploadPendingFiles)).subscribe(() => {
alert('UploadPendingFilesComplete');
this.store.dispatch(new CreateEmailLink(this.getPayload())).subscribe(
() => {
this.sent.emit('true');
},
(error) => {
console.log(error);
this.errors$.next(error.messages);
}
);
});
希望这种风格使用更多的 async-await,但它会在错误的时间触发。
this.store.dispatch(new UploadPendingFiles(pendingFiles));
alert('UploadPendingFilesComplete');
// Need alert to proc here
await this.actions$.pipe(ofActionSuccessful(UploadPendingFiles));
// await Another @Action
await this.store.dispatch(new CreateEmailLink(this.getPayload()));
// Alert procs here at the moment
@Action 的 sn-p
@Action(UploadPendingFiles)
uploadPendingFiles(ctx: StateContext<DriveStateModel>, action: UploadFiles) {
return this.uploads.start(action.files, config).pipe(
tap((response) => {
}
}
【问题讨论】: