當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript react-promise-tracker.trackPromise函數代碼示例

本文整理匯總了TypeScript中react-promise-tracker.trackPromise函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript trackPromise函數的具體用法?TypeScript trackPromise怎麽用?TypeScript trackPromise使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了trackPromise函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: trackPromise

export const fetchMembersAction = () => (dispatch) => {
  trackPromise(
    memberAPI.fetchMembersAsync()
    .then((members) => {
      dispatch(fetchMembersCompleted(members));
    })
  );
};
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:8,代碼來源:fetchMembers.ts

示例2: trackPromise

export const memberFieldChangeAction = (member: MemberEntity, fieldName: string, value: any) => (dispatch) => {
  trackPromise(
    memberFormValidation.validateField(member, fieldName, value)
    .then((fieldValidationResult) => {
      dispatch(memberFieldChangeCompleted(fieldValidationResult, value));
    })
    );
};
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:8,代碼來源:memberFieldChange.ts

示例3: trackPromise

export const fetchMemberByIdAction = (id: number) => (dispatch) => (
  trackPromise(
    memberAPI.fetchMemberByIdAsync(id)
      .then((member) => {
        dispatch(fetchMemberByIdCompleted(member));
      })
  )
);
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:8,代碼來源:fetchMemberById.ts

示例4: trackPromise

export const fetchRepositoriesAction = () => (dispatch) => {
    trackPromise(
        memberAPI.fetchRepositoriesAsync()
            .then((repos) => {
                dispatch(fetchReposCompleted(repos));
            })
    );
};
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:8,代碼來源:fetchRepositories.ts

示例5: trackPromise

export const fetchMembers = () => (dispatch) => (
  trackPromise(
    memberAPI.fetchMembers()
    .then((members) => {
      dispatch(fetchMembersCompleted(members));
    })
  )
  );
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:8,代碼來源:fetchMembers.ts

示例6: trackPromise

const saveMember = (member: MemberEntity) => {
  trackPromise(
    memberAPI.saveMember(member)
      .then(() => {
        toastr.success('Member saved.');
        history.back();
      })
      .catch(toastr.error)
  );
};
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:10,代碼來源:saveMember.ts

示例7: trackPromise

export const saveMemberAction = (member: MemberEntity) => (dispatch) => {
  trackPromise(
    memberFormValidation.validateForm(member)
      .then((formValidationResult) => {
        if (formValidationResult.succeeded) {
          saveMember(member);
        }
        dispatch(saveMemberActionCompleted(formValidationResult));
      })
    );
};
開發者ID:Lemoncode,項目名稱:react-typescript-samples,代碼行數:11,代碼來源:saveMember.ts


注:本文中的react-promise-tracker.trackPromise函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。