feat(overlay): dont fetch player data if the settings is off
All checks were successful
deploy / deploy (push) Successful in 58s

This commit is contained in:
Lee 2023-11-05 21:04:07 +00:00
parent d574d701f6
commit 11826faa9a

@ -59,18 +59,20 @@ export default class Overlay extends Component<OverlayProps, OverlayState> {
const settings = JSON.parse(data);
this.setState({ settings: settings });
this.updatePlayer(settings.accountId);
if (settings.settings.showPlayerStats) {
this.updatePlayer(settings.playerId);
setInterval(() => {
this.updatePlayer(settings.accountId);
this.updatePlayer(settings.playerId);
}, UPDATE_INTERVAL);
}
}
render() {
const { player } = this.state;
if (!this.state.mounted || !player) {
return (
<main className="flex items-center p-3">
<main className="flex items-center !bg-transparent p-3">
<Spinner />
<p className="text-xl">Loading player data</p>
</main>