Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function process_401(e, path) {
const { extra, request } = e;
const { options: { method } } = request;
// GET /system/session
// no notify , but redirect to /login
if (method == SESSION_SYNC_REQ.verb && _.startsWith(path, SESSION_SYNC_REQ.uri)) {
router.push('/login');
}
// POST /system/session
// notify, but don't redirect to /login
else if (method == SESSION_CREATE_REQ.verb && _.startsWith(path, SESSION_CREATE_REQ.uri)) {
notifyError(
extra.statusText,
extra.status,
request.url,
extra.data? extra.data.message : extra.statusText,
method,
);
}
// other requests
// notify, and redirect to /login
export function redirectTo(to, from) {
if (isString(to) || isString(from)) {
if (!from) {
return router.push(to)
}
return router.push({
pathname: to,
query: {
from
}
})
}
// to为完整的RouteData
return router.push(to)
}
}, () => {
if (res.success === true) {
router.push('./list');
} else {
notification.error({ message: res.message, });
}
});
});
gotoExtInfoPage = () => {
router.push({
pathname: '/extinfo',
query: { id: 123 },
});
};
onClick={() => {
router.push({
pathname: `/setting/deliver/shipper/edit`,
search: `?id=${record.id}`
});
}}
>
<button type="primary"> router.push('/')}>
Back Home</button>
handleEdit = () => {
const {
match: {
params: { id },
},
} = this.props;
router.push(`/desk/notice/edit/${id}`);
};
}).then(res => {
this.setState({ submitting: false });
if (res.success === true) {
router.push('./list');
} else {
notification.error({ message: res.message, });
}
});
}
handleAdd = () => {
router.push('./add');
};
handleEdit = () => {
const {
match: {
params: { id },
},
} = this.props;
router.push(`/system/tenant/edit/${id}`);
};