Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
signOutDueToInactivity() {
// Store that this sign out was for inactivity in local storage.
Lockr.set(SIGNED_OUT_DUE_TO_INACTIVITY, true);
// Redirect the user to let the server sort out where they should
// be now
redirectBrowser();
}
_sessionUrl(id) {
setTimeout(() => {
this.setState({
confirmLoading: false,
});
// store the uploaded data in localStorage so it's persistant
Lockr.prefix = 'userData';
Lockr.set('deposits', JSON.stringify(this.props.deposits));
Lockr.set('withdrawls', JSON.stringify(this.props.withdrawls));
Lockr.set('trades', JSON.stringify(this.props.trades));
Lockr.set('demo', JSON.stringify(false));
// signal that all data has been successfully uploaded and that it's time to show some juicy visualizations
this.props.dispatch({type: 'userData/allDataUploaded'});
this.hideFileUploader();
// since this is real user data, set the `isDemo` flag to false
this.props.dispatch({type: 'globalData/setDemoFlag', isDemo: false});
// hard-refresh the page since components are wired to not watch for changes to static user data
window.location.reload();
}, 1234);
this.setState({
componentWillUnmount() {
let { code, CompileStatus, compileInfo, contractNameList, compileFiles } = this.state;
if (CompileStatus && code !== '// type your code...'){
Lockr.set('CompileCode', code);
Lockr.set('CompileStatus', CompileStatus);
Lockr.set('compileInfo', compileInfo);
Lockr.set('contractNameList', contractNameList);
// file转base64保存
let list = [];
compileFiles.map(v => {
let reader = new FileReader();
const isFile = v instanceof File;
reader.readAsDataURL(isFile ? v : v.originFileObj, 'UTF-8');
reader.onloadend = (evt) => {
const dataUrl = evt.target.result;
list.push({ dataUrl, name: v.name });
Lockr.set('compileFiles', list);
};
});
}
}
reader.onloadend = (evt) => {
const dataUrl = evt.target.result;
list.push({ dataUrl, name: v.name });
Lockr.set('compileFiles', list);
};
});
this.setState({
optional
});
}
Lockr.set("optional", optional);
} else {
let optional = Lockr.get("dex20") || [];
if (optional.indexOf(id) == -1) {
optional.push(id);
} else {
optional = _.remove(optional, n => {
return n !== id;
});
}
Lockr.set("dex20", optional);
}
};
async loadHomepageBundle() {
let { data } = await xhr.get(`${API_URL}/api/system/homepage-bundle`);
Lockr.set("dataEth", data.priceETH);
Lockr.set("dataEur", data.priceEUR);
this.setState({
onlineNodes: data.node.total,
maxTps: data.tps.data.maxTps ? data.tps.data.maxTps : 0,
tps: data.tps.data.currentTps ? data.tps.data.currentTps : 0,
blockHeight: data.tps.data.blockHeight ? data.tps.data.blockHeight : 0,
transactionPerDay: data.yesterdayStat.data[0].newTransactionSeen
});
}
export function setCollapseNumber(value) {
lockr.set('collapseNumber', value);
}
async loadHomepageBundle() {
let { data } = await xhr.get(`${API_URL}/api/system/homepage-bundle`);
Lockr.set("dataEth", data.priceETH);
Lockr.set("dataEur", data.priceEUR);
this.setState({
onlineNodes: data.node.total,
maxTps: data.tps.data.maxTps ? data.tps.data.maxTps : 0,
tps: data.tps.data.currentTps ? data.tps.data.currentTps : 0,
blockHeight: data.tps.data.blockHeight ? data.tps.data.blockHeight : 0,
transactionPerDay: data.yesterdayStat.data[0].newTransactionSeen
});
}
}).finally(() => {
lockr.set('lists.lists', lists)
this.lists = lists
})
}
export function setWaitUntilFetched(boolean) {
lockr.set('waitUntilFetched', boolean);
}