本文整理匯總了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));
})
);
};