redux-sequential-async-actions
v1.0.0
Published
redux async sequential
Downloads
3
Maintainers
Readme
redux async actions,support sequential
options
- sequential,是否顺序执行
- prefix
安装:
npm i redux-sequential-async-actions
使用方式:
applyMiddleware(
reduxRequestWithCallbactions('/prefix')
)
export function fetchPageBaseInfo(pageId) {
return {
type: types.FETCH_PAGE_BASE_INFO,
url: `/dva/api/pages-history/${pageId}`,
sequential: true,//promise来支持顺序
callbactions: (result) => {
const {id, Scene, pageConfig, host} = result
return [
createQRCodePreview({pageKind: 'page', pageId: id, host}),
getCurrentScene(Scene),
// 因显示widget和setting和content具有依赖性,故此顺序
fetchWidgets(pageConfig),
fetchSettings({pageId: id, pageKind: 'page', ...pageConfig}),
fetchSections({pageId: id, pageKind: 'page'})
]
}
}
}