Add logic for param checking (redirections from old domain)

This commit is contained in:
awex 3
2022-03-30 20:01:57 -04:00
parent d8dd475498
commit 1437dcf839
5 changed files with 45 additions and 17 deletions
+4
View File
@@ -24,6 +24,10 @@ hr {
width:20%;
}
#querydiv {
padding-top:40px;
}
.welcome {
width: 100%;
background-image: url('../../static/img/profile.png');
+24
View File
@@ -0,0 +1,24 @@
async function paramSearch() {
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
const div = document.getElementById("querydiv");
if (params.reason) {
if (params.reason == "old_domain") {
div.innerHTML = '<p style="color:red;">You have been redirected here from an old domain. Please use this domain.</p>';
}
}
const clipSpan = document.getElementById("clip");
const response = await fetch("https://developers.medal.tv/v1/latest?userId=215577&limit=1", {
method: "GET",
headers: {
"authorization": "pub_ecEyOlY5G2u9476DMGOxcxiNcaOTEjmq",
"Content-Type": "application/json"
}
});
const data = await response.json();
clipSpan.innerHTML = `${data.contentObjects[0].embedIframeCode}<br>${data.contentObjects[0].contentTitle}`;
}
window.onload = paramSearch();