Added same mounting fix to the main page
This commit is contained in:
parent
3c42a7ac60
commit
ed0d1b05ec
@ -25,6 +25,7 @@ export default class Home extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this._mounted = false;
|
||||||
this.state = {
|
this.state = {
|
||||||
loading: true,
|
loading: true,
|
||||||
steamId: undefined,
|
steamId: undefined,
|
||||||
@ -44,6 +45,11 @@ export default class Home extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
if (this._mounted === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._mounted = true;
|
||||||
|
|
||||||
const urlSearchParams = new URLSearchParams(window.location.search);
|
const urlSearchParams = new URLSearchParams(window.location.search);
|
||||||
const params = Object.fromEntries(urlSearchParams.entries());
|
const params = Object.fromEntries(urlSearchParams.entries());
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ export default class Overlay extends Component {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this._mounted = false;
|
|
||||||
|
|
||||||
|
this._mounted = false;
|
||||||
this.state = {
|
this.state = {
|
||||||
hasError: false,
|
hasError: false,
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ export default class Overlay extends Component {
|
|||||||
},
|
},
|
||||||
rightHand: {
|
rightHand: {
|
||||||
averageCut: [15.0],
|
averageCut: [15.0],
|
||||||
averagePreSwing: [70.0],
|
averagePreSwing: [70.0],dd
|
||||||
averagePostSwing: [30.0],
|
averagePostSwing: [30.0],d
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.setupTimer();
|
this.setupTimer();
|
||||||
@ -128,7 +128,6 @@ export default class Overlay extends Component {
|
|||||||
|
|
||||||
// Handle Errors
|
// Handle Errors
|
||||||
static getDerivedStateFromError(error) {
|
static getDerivedStateFromError(error) {
|
||||||
console.log(error);
|
|
||||||
return this.setState({ hasError: true });
|
return this.setState({ hasError: true });
|
||||||
}
|
}
|
||||||
componentDidCatch(error, errorInfo) {
|
componentDidCatch(error, errorInfo) {
|
||||||
@ -210,8 +209,6 @@ export default class Overlay extends Component {
|
|||||||
async validateSteamId(id) {
|
async validateSteamId(id) {
|
||||||
const data = await fetch(`/api/validateid?steamid=${id}`);
|
const data = await fetch(`/api/validateid?steamid=${id}`);
|
||||||
const json = await data.json();
|
const json = await data.json();
|
||||||
console.log(json);
|
|
||||||
|
|
||||||
return json.message === "Valid" ? true : false;
|
return json.message === "Valid" ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user