Last active
October 25, 2023 21:38
-
-
Save michaelmeneses/488a836d35987062aa7c2c212246b2fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const baseUrlProxy = "https://webhook.site/a0435441-b221-4c98-a91b-cc80657d35c6"; | |
const urlParams = new URLSearchParams(window.location.search); | |
const contentSecret = urlParams.get('contentSecret'); | |
const frmContent = document.getElementById("frmContent"); | |
var API = getAPI(); | |
var params = new URLSearchParams(); | |
params.append("consumerKey", consumerKey); | |
params.append("contentSecret", contentSecret); | |
params.append("redirect", false); | |
const getUrlContent = new XMLHttpRequest(); | |
getUrlContent.responseType = 'json'; | |
getUrlContent.open("GET", baseUrlProxy + '?' + (params.toString()), true); | |
getUrlContent.setRequestHeader("Content-Type", "application/json"); | |
getUrlContent.onload = function() { | |
var response = getUrlContent.response; | |
if (getUrlContent.status == 200 && response.contentUrl != null && response.contentUrl != '') { | |
console.log(response.contentUrl); | |
} else if (response.errors != null && response.errors != '') { | |
var spanError = document.createElement('span'); | |
spanError.innerHTML = response.errors; | |
document.body.appendChild(spanError); | |
} | |
}; | |
getUrlContent.send(null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment