Skip to content

Commit

Permalink
chore(overlay): add an error handler for data validation
Browse files Browse the repository at this point in the history
  • Loading branch information
haxgun committed Oct 31, 2023
1 parent 47ff92a commit 14a98ae
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/js/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,17 @@ async function updatePlayerCard(region, puuid) {
}

async function checkData(region, puuid) {
const response = await fetch(`${apiUrl}/v1/by-puuid/mmr/${region}/${puuid}`)
const data = await response.json();
const returnStatus = data.status;
const checkifnull = data.data.currenttier;

if (returnStatus === 200 && checkifnull !== null) {
await updatePlayerCard(region, puuid);
try {
const response = await fetch(`${apiUrl}/v1/by-puuid/mmr/${region}/${puuid}`)
const data = await response.json();
const returnStatus = data.status;
const checkifnull = data.data.currenttier;

if (returnStatus === 200 && checkifnull !== null) {
await updatePlayerCard(region, puuid);
}
} catch (error) {
// pass
}
await winlose(region, puuid)
}
Expand Down

0 comments on commit 14a98ae

Please sign in to comment.