Skip to content

Commit 752c555

Browse files
committed
fix: update key and query routers
- update hdevApiKeys - also update routers for query params
1 parent 94691ba commit 752c555

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/js/main.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ document.querySelector("#app").innerHTML = `
158158
</svg>
159159
</span>
160160
<input
161-
@keyup.enter="if (await checkNickname(nickname)) { getPreview(); search = true; main();} else { alert = true; setTimeout(() => alert = false, 5000)}"
161+
@keyup.enter="if (await checkNickname(nickname, hdevApiKey)) { getPreview(); search = true; main();} else { alert = true; setTimeout(() => alert = false, 5000)}"
162162
x-model="hdevApiKey"
163163
class="nickname"
164164
id="hdevApi"
@@ -574,9 +574,11 @@ document.querySelector("#app").innerHTML = `
574574

575575
async function getPreview() {
576576
const hdevApiKey = document.getElementById("hdevApi").value;
577+
console.log(hdevApiKey);
577578
// Get Nickname, Tag, Region
578579
const inputNicknameWithTag = document.getElementById("nickname_with_tag");
579580
const nicknameWithTag = inputNicknameWithTag.value;
581+
console.log(nicknameWithTag);
580582
const [nickname, tag] = nicknameWithTag.split("#");
581583

582584
// Color Settings
@@ -650,7 +652,7 @@ async function generateLink(
650652
nickname +
651653
"&tag=" +
652654
tag +
653-
"&hdevApiKey="+
655+
"&hdevApiKey=" +
654656
hdevApiKey +
655657
"&textColor=" +
656658
textColor +
@@ -703,7 +705,7 @@ copyButton.onclick = function () {
703705
};
704706

705707
async function main() {
706-
const hdevApiKey= document.getElementById("hdevApi").value;
708+
const hdevApiKey = document.getElementById("hdevApi").value;
707709
const inputNicknameWithTag = document.getElementById("nickname_with_tag");
708710
const nicknameWithTag = inputNicknameWithTag.value;
709711
const [nickname, tag] = nicknameWithTag.split("#");
@@ -839,7 +841,7 @@ async function getPuuidWithRegion(nickname, tag, hdevApiKey) {
839841

840842
async function getLeaderboard(region, puuid, hdevApiKey) {
841843
const response = await fetch(
842-
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}?api_key=${hdevApiKey}`,
844+
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}&api_key=${hdevApiKey}`,
843845
);
844846
const data = await response.json();
845847
return data.status === 404 ? " " : data.data[0].leaderboardRank;

src/js/overlay.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const {
1717
progressRankBgColor,
1818
} = {
1919
hdevApiKey:
20-
urlParams.get("hdevApiKey"),
20+
urlParams.get("hdevApiKey"),
2121
textColor: urlParams.get("textColor").replace("#", ""),
2222
primaryColor: urlParams.get("primaryColor").replace("#", ""),
2323
bgColor: urlParams.get("bgColor").replace("#", ""),
@@ -92,7 +92,7 @@ async function getPlayerInformation(region, puuid, hdevApiKey) {
9292

9393
async function getLeaderboard(region, puuid, hdevApiKey) {
9494
const response = await fetch(
95-
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}?api_key=${hdevApiKey}`,
95+
`${apiUrl}/v1/leaderboard/${region}?puuid=${puuid}&api_key=${hdevApiKey}`,
9696
);
9797
const data = await response.json();
9898
return data.status === 404 ? " " : data.data[0].leaderboardRank;
@@ -143,7 +143,7 @@ async function updatePlayerCard(region, puuid, hdevApiKey) {
143143
if (playerLastGamePts === "nRanked") {
144144
playerRank.innerHTML = playerElo;
145145
} else if (playerTier === 27) {
146-
const leaderboardRank = await getLeaderboard(region, puuid);
146+
const leaderboardRank = await getLeaderboard(region, puuid, hdevApiKey);
147147
if (leaderboardRank !== " ") {
148148
playerRank.innerHTML = `${playerElo} #${leaderboardRank}`;
149149
}
@@ -247,7 +247,7 @@ async function getWonInfo(puuid, dataMatches, hdevApiKey) {
247247

248248
async function getMatches(region, puuid, hdevApiKey) {
249249
const response = await fetch(
250-
`${apiUrl}/v3/by-puuid/matches/${region}/${puuid}?filter=competitive&size=1?api_key=${hdevApiKey}`,
250+
`${apiUrl}/v3/by-puuid/matches/${region}/${puuid}?filter=competitive&size=1&api_key=${hdevApiKey}`,
251251
);
252252
return await response.json();
253253
}

0 commit comments

Comments
 (0)