Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const errorHandler = (error: ResponseError) => {
const { response = {} as Response } = error;
const errortext = codeMessage[response.status] || response.statusText;
const { status, url } = response;
if (status === 401) {
notification.error({
message: '未登录或登录已过期,请重新登录。',
});
router.push('/user/login');
return;
} else {
notification.error({
message: `请求错误 ${status}: ${url}`,
description: errortext,
});
}
};
onClick={() => {
router.push('/flow-editor/' + flow.id);
}}
>
const onBack = () => {
router.push('/articles');
TDAPP.onEvent('文章编辑-返回');
};
saveCondition();
const page = editor!.getCurrentPage();
const nodes: EditorNode[] | undefined = page.save().nodes;
const flowModel: FlowModel = { ...flowAttributes, id: flowId };
if (nodes === undefined) {
notification.error({ message: formatMessage({ id: 'flow.node.empty' }) });
return;
}
const jobModelList: JobModel[] = nodes.map(node => JobModel.getInstance(node));
if (dispatch) {
const res = await addFlow({ flowModel, jobModelList });
if (res === undefined) {
return;
}
router.push('/flow/list');
notification.success({ message: formatMessage({ id: 'flow.create.success' }) });
}
}
onChange={activeKey => {
if (activeKey === 'user') {
router.push('/admin/user');
} else {
router.push('/admin/client');
}
}}
>