当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ActionCreator.default方法代码示例

本文整理汇总了TypeScript中redux.ActionCreator.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ActionCreator.default方法的具体用法?TypeScript ActionCreator.default怎么用?TypeScript ActionCreator.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redux.ActionCreator的用法示例。


在下文中一共展示了ActionCreator.default方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: fetchMemberByUid

async function fetchMemberByUid(dispatch: Dispatch<AppState>, uid: string) {
  dispatch(requestMemberByUid(uid));
  const memberDoc = await db
    .collection("members")
    .doc(uid)
    .get();
  // TODO error handling
  dispatch(receiveMember(memberDoc, uid, false));
}
开发者ID:rahafoundation,项目名称:raha-web-app,代码行数:9,代码来源:index.ts

示例2: async

 return async (dispatch: Dispatch<IAction<IFeature[]>>) => {
     try {
         const features: IFeature[] = await api.getFeatures(feature.scope)
         if (feature.scope === FeatureScope.Web) {
             dispatch(getWebFeaturesSuccess(features, feature));
         } else {
             dispatch(getSiteFeaturesSuccess(features, feature));
         }
     } catch (error) {
         dispatch(handleAsyncError(constants.ERROR_MESSAGE_GETTING_FEATURES, error));
     }
 };
开发者ID:DariuS231,项目名称:ChromeSPPropertiesAdmin,代码行数:12,代码来源:spFeaturesActions.ts

示例3: fetchMemberByMid

async function fetchMemberByMid(
  dispatch: Dispatch<AppState>,
  username: string
) {
  dispatch(requestMemberByUsername(username));
  const memberQuery = await db
    .collection("members")
    .where("username", "==", username)
    .get();
  if (memberQuery.docs.length > 1) {
    alert(
      `Found multiple matching member ${username}, please email bugs@raha.io`
    );
  }
  const memberDoc = memberQuery.docs.length === 1 ? memberQuery.docs[0] : null;
  dispatch(receiveMember(memberDoc, username, true));
}
开发者ID:rahafoundation,项目名称:raha-web-app,代码行数:17,代码来源:index.ts

示例4: async

 return async (dispatch: Dispatch<IAction<ISiteContent[]>>) => {
     try {
         const siteContent: ISiteContent[] = await api.getLists();
         if (typeof messageData !== "undefined") {
             dispatch(setAllSiteContentAndMessage(siteContent, messageData));
         } else {
             dispatch(setAllSiteContent(siteContent));
         }
     } catch (error) {
         // tslint:disable-next-line:no-console
         console.log(error);
         dispatch(setMessageData({
             message: constants.ERROR_MESSAGE_GET_ALL_SITE_CONTENT,
             showMessage: true,
             type: MessageBarType.error
         }));
     }
 };
开发者ID:DariuS231,项目名称:ChromeSPPropertiesAdmin,代码行数:18,代码来源:spSiteContentActions.ts

示例5: addTodo

  Action,
  Dispatch,
  bindActionCreators,
  ActionCreatorsMapObject
} from 'redux'

interface AddTodoAction extends Action {
  text: string
}

const addTodo: ActionCreator<AddTodoAction> = (text: string) => ({
  type: 'ADD_TODO',
  text
})

const addTodoAction: AddTodoAction = addTodo('test')

type AddTodoThunk = (dispatch: Dispatch) => AddTodoAction

const addTodoViaThunk: ActionCreator<AddTodoThunk> = (text: string) => (
  dispatch: Dispatch
) => ({
  type: 'ADD_TODO',
  text
})

declare const dispatch: Dispatch

const boundAddTodo = bindActionCreators(addTodo, dispatch)

const dispatchedAddTodoAction: AddTodoAction = boundAddTodo('test')
开发者ID:Evan726,项目名称:redux,代码行数:31,代码来源:actionCreators.ts

示例6: dispatch

) => dispatch => {
  if (firebaseUser) {
    dispatch(fetchMemberByUidIfNeeded(firebaseUser.uid));
  }
  dispatch(setFirebaseUser(firebaseUser));
};
开发者ID:rahafoundation,项目名称:raha-web-app,代码行数:6,代码来源:index.ts


注:本文中的redux.ActionCreator.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。