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