Skip to content

Commit

Permalink
Merge pull request #7 from GoToProd/main
Browse files Browse the repository at this point in the history
fix: update key and query routers
  • Loading branch information
haxgun authored Oct 15, 2024
2 parents 94691ba + 752c555 commit a131cf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ document.querySelector("#app").innerHTML = `
</svg>
</span>
<input
@keyup.enter="if (await checkNickname(nickname)) { getPreview(); search = true; main();} else { alert = true; setTimeout(() => alert = false, 5000)}"
@keyup.enter="if (await checkNickname(nickname, hdevApiKey)) { getPreview(); search = true; main();} else { alert = true; setTimeout(() => alert = false, 5000)}"
x-model="hdevApiKey"
class="nickname"
id="hdevApi"
Expand Down Expand Up @@ -574,9 +574,11 @@ document.querySelector("#app").innerHTML = `

async function getPreview() {
const hdevApiKey = document.getElementById("hdevApi").value;
console.log(hdevApiKey);
// Get Nickname, Tag, Region
const inputNicknameWithTag = document.getElementById("nickname_with_tag");
const nicknameWithTag = inputNicknameWithTag.value;
console.log(nicknameWithTag);
const [nickname, tag] = nicknameWithTag.split("#");

// Color Settings
Expand Down Expand Up @@ -650,7 +652,7 @@ async function generateLink(
nickname +
"&tag=" +
tag +
"&hdevApiKey="+
"&hdevApiKey=" +
hdevApiKey +
"&textColor=" +
textColor +
Expand Down Expand Up @@ -703,7 +705,7 @@ copyButton.onclick = function () {
};

async function main() {
const hdevApiKey= document.getElementById("hdevApi").value;
const hdevApiKey = document.getElementById("hdevApi").value;
const inputNicknameWithTag = document.getElementById("nickname_with_tag");
const nicknameWithTag = inputNicknameWithTag.value;
const [nickname, tag] = nicknameWithTag.split("#");
Expand Down Expand Up @@ -839,7 +841,7 @@ async function getPuuidWithRegion(nickname, tag, hdevApiKey) {

async function getLeaderboard(region, puuid, hdevApiKey) {
const response = await fetch(
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}?api_key=${hdevApiKey}`,
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}&api_key=${hdevApiKey}`,
);
const data = await response.json();
return data.status === 404 ? " " : data.data[0].leaderboardRank;
Expand Down
8 changes: 4 additions & 4 deletions src/js/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
progressRankBgColor,
} = {
hdevApiKey:
urlParams.get("hdevApiKey"),
urlParams.get("hdevApiKey"),
textColor: urlParams.get("textColor").replace("#", ""),
primaryColor: urlParams.get("primaryColor").replace("#", ""),
bgColor: urlParams.get("bgColor").replace("#", ""),
Expand Down Expand Up @@ -92,7 +92,7 @@ async function getPlayerInformation(region, puuid, hdevApiKey) {

async function getLeaderboard(region, puuid, hdevApiKey) {
const response = await fetch(
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}?api_key=${hdevApiKey}`,
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}&api_key=${hdevApiKey}`,
);
const data = await response.json();
return data.status === 404 ? " " : data.data[0].leaderboardRank;
Expand Down Expand Up @@ -143,7 +143,7 @@ async function updatePlayerCard(region, puuid, hdevApiKey) {
if (playerLastGamePts === "nRanked") {
playerRank.innerHTML = playerElo;
} else if (playerTier === 27) {
const leaderboardRank = await getLeaderboard(region, puuid);
const leaderboardRank = await getLeaderboard(region, puuid, hdevApiKey);
if (leaderboardRank !== " ") {
playerRank.innerHTML = `${playerElo} #${leaderboardRank}`;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ async function getWonInfo(puuid, dataMatches, hdevApiKey) {

async function getMatches(region, puuid, hdevApiKey) {
const response = await fetch(
`${apiUrl}/v3/by-puuid/matches/${region}/${puuid}?filter=competitive&size=1?api_key=${hdevApiKey}`,
`${apiUrl}/v3/by-puuid/matches/${region}/${puuid}?filter=competitive&size=1&api_key=${hdevApiKey}`,
);
return await response.json();
}
Expand Down

0 comments on commit a131cf6

Please sign in to comment.