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); const settings = JSON.parse(data);
this.setState({ settings: settings }); this.setState({ settings: settings });
this.updatePlayer(settings.accountId); if (settings.settings.showPlayerStats) {
this.updatePlayer(settings.playerId);
setInterval(() => { setInterval(() => {
this.updatePlayer(settings.accountId); this.updatePlayer(settings.playerId);
}, UPDATE_INTERVAL); }, UPDATE_INTERVAL);
} }
}
render() { render() {
const { player } = this.state; const { player } = this.state;
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>