Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.props.logoutUser().then(result => {
if (result.type === LOGOUT_REJECTED) {
// Display error notification
notify.show(t("error.logout"), "error");
} else {
clearToken(); // Clear security token in browser
fetch.clearSecurityToken(); // Clear token in fetch header
// Refresh Browser Window
const url = `${BUILD_PROTOCOL}://${this.props.user.get("workspaceURL")}.${BUILD_DOMAINPATH}/signin`;
window.location.replace(url);
}
});
}
this.props.logoutUser().then(result => {
if (result.type === LOGOUT_REJECTED) {
// Display error notification
notify.show(t("error.logout"), "error");
} else {
clearToken(); // Clear security token in browser
fetch.clearSecurityToken(); // Clear token in fetch header
// Refresh Browser Window
const url = `${BUILD_PROTOCOL}://${this.props.user.get("workspaceURL")}.${BUILD_DOMAINPATH}/signin`;
window.location.replace(url);
}
});
}
async assignToMe(e) {
e.preventDefault();
const { setAssignee, data } = this.props;
const ecode = await setAssignee(data.id, { assignee: 'me' });
if (ecode === 0) {
notify.show('已分配给我。', 'success', 2000);
} else {
notify.show('问题分配失败。', 'error', 2000);
}
// fix me
//if (ecode === 0) {
//} else {
//}
}
event.watch((error, result) => {
if (!error){
this.props.history.push('/');
notify.show("Product created.", "custom", 5000, { background: '#50b796', text: "#FFFFFF" });
} else {
console.log(error);
}
});
async handleSubmit() {
const { values, create, close, query={} } = this.props;
values.query = _.omit(query, [ 'page' ]);
const ecode = await create(values);
if (ecode === 0) {
this.setState({ ecode: 0 });
close();
notify.show('保存完成。', 'success', 2000);
} else {
this.setState({ ecode: ecode });
}
}
async handleSubmit() {
const { index, imports, close } = this.props;
const ecode = await imports(_.pick(this.state, [ 'fid', 'pattern' ]));
if (ecode === 0) {
this.setState({ ecode: 0 });
close();
notify.show('导入完成。', 'success', 2000);
index();
} else {
this.setState({ ecode: ecode });
}
}
async handleSubmit() {
const { values, update, close } = this.props;
const ecode = await update(values.id, _.extend({}, _.omit(values, ['id']), { principal: values.principal && values.principal.id || '' }));
if (ecode === 0) {
this.setState({ ecode: 0 });
close();
notify.show('项目已更新。', 'success', 2000);
} else {
this.setState({ ecode: ecode });
}
}
async handleSubmit() {
const { values, copy, close } = this.props;
const ecode = await copy(_.mapKeys(values, function (value, key) { return key == 'id' ? 'source_id' : key }));
if (ecode === 0) {
this.setState({ ecode: 0 });
close();
notify.show('复制完成。', 'success', 2000);
} else {
this.setState({ ecode: ecode });
}
}
async handleSubmit() {
const { values, create, close } = this.props;
const ecode = await create(values);
if (ecode === 0) {
this.setState({ ecode: 0 });
close();
notify.show('创建完成。', 'success', 2000);
} else {
this.setState({ ecode: ecode });
}
}
async operateSelect(eventKey) {
const { hoverRowId } = this.state;
const { test } = this.props;
if (eventKey == 'test') {
const ecode = await test(hoverRowId);
if (ecode === 0) {
notify.show('测试成功。', 'success', 2000);
} else {
notify.show('测试失败', 'error', 2000);
}
} else {
this.operateNotify(hoverRowId);
this.setState({ operate: eventKey });
}
}