This commit is contained in:
parent
fc3e8e8c16
commit
2fecf0abae
@ -8,22 +8,19 @@ export default class PlayerPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async onLoad() {
|
public async onLoad() {
|
||||||
let loadingElement;
|
const id: string = getPlayerIdFromUrl(); // Get the player's ID from the URL
|
||||||
let titleElement;
|
|
||||||
try {
|
|
||||||
// Wait for the title element to load, so we know the page is fully loaded
|
// Wait for the title element to load, so we know the page is fully loaded
|
||||||
titleElement = await getElement(
|
const titleElement = await getElement(
|
||||||
".title.is-5.player.has-text-centered-mobile",
|
".title.is-5.player.has-text-centered-mobile",
|
||||||
);
|
);
|
||||||
const id: string = getPlayerIdFromUrl();
|
const removeLoadingElements = await this.addLoadingElement(titleElement);
|
||||||
|
try {
|
||||||
loadingElement = await this.addLoadingElement(titleElement);
|
|
||||||
const player: any = await getPlayer(id);
|
const player: any = await getPlayer(id);
|
||||||
loadingElement(); // Remove the loading element
|
removeLoadingElements(); // Remove the loading elements
|
||||||
|
|
||||||
await this.addStats(player); // Add our custom stats
|
await this.addStats(player); // Add our custom stats
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loadingElement(); // Remove the loading element
|
removeLoadingElements(); // Remove the loading elements
|
||||||
|
|
||||||
if (error.message.includes("inactive")) {
|
if (error.message.includes("inactive")) {
|
||||||
await this.addLoadingElement(
|
await this.addLoadingElement(
|
||||||
|
Loading…
Reference in New Issue
Block a user