fix things

This commit is contained in:
David Ralph
2020-09-17 14:49:27 +01:00
parent b5e5b8618e
commit f38749961b
4 changed files with 8 additions and 3 deletions

View File

@@ -22,7 +22,11 @@ export default class Quote extends React.PureComponent {
}
getQuotePack() {
const quotePack = JSON.parse(localStorage.getItem('quote_packs'));
let quotePack = localStorage.getItem('quote_packs');
console.log(quotePack)
if (quotePack === 'undefined') return this.doOffline();
quotePack = JSON.parse(quotePack);
if (quotePack) {
const data = quotePack[Math.floor(Math.random() * quotePack.length)];
return this.setState({