redux-sequential-async-actions

1.0.0 • Public • Published

redux async actions,support sequential

options

  1. sequential,是否顺序执行
  2. 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'})
            ]
        }
    }
}

Package Sidebar

Install

npm i redux-sequential-async-actions

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • donggw2030521