fix ratelimit returning undefined

This commit is contained in:
David Ralph
2020-08-28 22:06:16 +01:00
parent 291e7bcb82
commit a672c60afd
2 changed files with 3 additions and 1 deletions

View File

@@ -70,6 +70,8 @@ export default class Background extends React.PureComponent {
data = await fetch(requestURL);
data = await data.json();
if (data.statusCode === 429) return this.doOffline(); // If we hit the ratelimit, we fallback to local quotes
document.getElementById('backgroundImage').setAttribute(
'style', `-webkit-filter:blur(${localStorage.getItem('blur')}px); background-image: url(${data.file})`
); // Set background and blur etc

View File

@@ -36,7 +36,7 @@ export default class Quote extends React.PureComponent {
try { // First we try and get a quote from the API...
let data = await fetch(Constants.API_URL + '/getQuote');
data = await data.json();
if (data.statusCode === 429) this.doOffline(); // If we hit the ratelimit, we fallback to local quotes
if (data.statusCode === 429) return this.doOffline(); // If we hit the ratelimit, we fallback to local quotes
this.setState({
quote: '"' + data.quote + '"',
author: data.author