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