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

@@ -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