本文整理汇总了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));
})
);
};
示例2: trackPromise
export const memberFieldChangeAction = (member: MemberEntity, fieldName: string, value: any) => (dispatch) => {
trackPromise(
memberFormValidation.validateField(member, fieldName, value)
.then((fieldValidationResult) => {
dispatch(memberFieldChangeCompleted(fieldValidationResult, value));
})
);
};
示例3: trackPromise
export const fetchMemberByIdAction = (id: number) => (dispatch) => (
trackPromise(
memberAPI.fetchMemberByIdAsync(id)
.then((member) => {
dispatch(fetchMemberByIdCompleted(member));
})
)
);
示例4: trackPromise
export const fetchRepositoriesAction = () => (dispatch) => {
trackPromise(
memberAPI.fetchRepositoriesAsync()
.then((repos) => {
dispatch(fetchReposCompleted(repos));
})
);
};
示例5: trackPromise
export const fetchMembers = () => (dispatch) => (
trackPromise(
memberAPI.fetchMembers()
.then((members) => {
dispatch(fetchMembersCompleted(members));
})
)
);
示例6: trackPromise
const saveMember = (member: MemberEntity) => {
trackPromise(
memberAPI.saveMember(member)
.then(() => {
toastr.success('Member saved.');
history.back();
})
.catch(toastr.error)
);
};
示例7: trackPromise
export const saveMemberAction = (member: MemberEntity) => (dispatch) => {
trackPromise(
memberFormValidation.validateForm(member)
.then((formValidationResult) => {
if (formValidationResult.succeeded) {
saveMember(member);
}
dispatch(saveMemberActionCompleted(formValidationResult));
})
);
};