Fix a bug that breaks the site if the secureID isn't found

This commit is contained in:
Tanner Collin 2017-01-10 01:40:28 +00:00
parent 33d7fb4294
commit ea1c6810a6

View File

@ -27,15 +27,23 @@ export default class Site extends React.Component {
} }
setId(url) { setId(url) {
let id = Shortid.generate();
try {
id = secureID;
} catch (err) {
console.log('SecureID not found. Using Shortid instead.');
}
if (this.state.storSupport) { if (this.state.storSupport) {
if (localStorage.getItem('id')) { if (localStorage.getItem('id')) {
this.state.id = url || localStorage.getItem('id'); this.state.id = url || localStorage.getItem('id');
} else { } else {
this.state.id = url || secureID || Shortid.generate(); this.state.id = url || id;
} }
localStorage.setItem('id', this.state.id); localStorage.setItem('id', this.state.id);
} else { } else {
this.state.id = url || secureID || Shortid.generate(); this.state.id = url || id;
} }
} }