Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
func.then((res) => {
this.setState({loading: false});
Toast.success(formatMessage({ id: 'SEND.SUCCESS' }), 3, () => onCancel(), true);
// PopupAPI.setPushMessage({
// title:`-${amount}${selectedToken.abbr} ${formatMessage({id:'NOTIFICATIONS.TITLE'})}`,
// message:formatMessage({id:'NOTIFICATIONS.MESSAGE'}),
// hash:res
// });
}).catch(error => {
Toast.fail(JSON.stringify(error), 3, () => {
yield put(action.fetchSuccess())
yield put(action.postWarOrderSuccess(response))
Toast.success('提交成功', 1)
yield delay(1000)
yield put(goBack())
} else {
yield put(action.postWarOrderFailed())
yield put(action.fetchFailed())
Toast.success(`1天最多发布${warOrderLimit}条比赛约战帖`, 2)
yield delay(2000)
yield put(goBack())
}
} catch (error) {
yield put(action.postWarOrderFailed(error))
yield put(action.fetchFailed())
Toast.success('提交失败', 1)
}
}
function* putGroupOrderWorker(payload) {
try {
yield put(action.fetchRequest({ text: '提交中' }))
const count = yield call(groupOrderService.getGroupOrderCountOfToday)
const userinfo = yield call(userService.getUserInfoToJson)
const groupOrderLimit = userinfo.groupOrderLimit
if (count <= groupOrderLimit) {
const response = yield call(groupOrderService.updateGroupOrder, payload)
yield put(action.fetchSuccess())
yield put(action.putGroupOrderSuccess(response))
Toast.success('提交成功', 1)
yield delay(1000)
yield put(replace('/account/grouporders'))
} else {
yield put(action.putGroupOrderFailed())
yield put(action.fetchFailed())
Toast.success(`1天最多发布${groupOrderLimit}条组队上分帖`, 1)
}
} catch (error) {
yield put(action.putGroupOrderFailed(error))
yield put(action.fetchFailed())
Toast.success('提交失败', 1)
}
}
function successToast() {
Toast.success('商品已加入购物车', 1);
}
function* putUserInfoWorker(payload) {
try {
Toast.loading('提交中')
const response = yield call(userService.putUserInfo, payload)
yield put(action.putUserInfoSuccess(response))
Toast.success('提交成功', 1.5)
yield delay(1500)
yield put(NavigationActions.back())
} catch (error) {
yield put(action.putUserInfoFailed(error))
Toast.fail('提交失败', 1.5)
}
}
function* deleteRecruitOrderWorker(payload) {
try {
yield put(action.fetchRequest({ text: '提交中' }))
const response = yield call(recruitOrderService.removeRecruitOrder, payload)
yield put(action.deleteRecruitOrderSuccess(response))
yield put(action.fetchSuccess())
Toast.success('删除成功', 1)
} catch (error) {
yield put(action.deleteRecruitOrderFailed(error))
yield put(action.fetchFailed())
Toast.success('删除失败', 1)
}
}
onClick={() => Toast.success("To be continued...")}
className={styles.checkout}
successToast(value) {
Toast.success(value, 2);
}
failToast(value) {
async decollect () {
if (!session.accesstoken || status.submitting) return;
try {
status.setSubmitting(true);
await axios.post('/topic_collect/de_collect', { accesstoken: session.accesstoken, topic_id: detail.detail.id });
detail.updateDetail('is_collect', false);
Toast.success('取消成功', 1);
} catch(err) {
Toast.success('取消失败', 1);
} finally {
status.setSubmitting(false);
}
}
function* putTeamsWorker(payload) {
try {
yield put(action.fetchRequest({ text: '提交中' }))
const response = yield call(teamsService.updateTeam, payload)
yield put(action.fetchSuccess())
yield put(action.putTeamsSuccess(response))
Toast.success('提交成功', 1)
yield delay(1000)
yield put(goBack())
} catch (error) {
yield put(action.fetchFailed())
yield put(action.putTeamsFailed())
Toast.fail('提交失败', 1)
}
}