Created
November 21, 2019 11:25
-
-
Save zoetrope69/05d1811aae821651d2ec535063ee5512 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 params = { | |
data: JSON.stringify({ | |
pubcode: "100796X1589911", | |
domains: [ | |
"beautyclub.glamourmagazine.co.uk", | |
"facebook.com", | |
"twitter.com", | |
"instagram.com", | |
"condenast.co.uk", | |
"pinterest.com", | |
"johnlewis.com", | |
"spacenk.com" | |
] | |
}) | |
}; | |
const urlParams = new URLSearchParams(Object.entries(params)); | |
console.log("urlParams", urlParams); | |
fetch("https://r.skimresources.com/api/", { | |
body: urlParams, | |
method: "POST" | |
}) | |
.then(response => response.json()) | |
.then(response => { | |
const hasAffliates = response.merchant_domains.length > 0; | |
console.log(response); | |
console.log(hasAffliates ? "Has affliates" : "Doesn't have affliates"); | |
}) | |
.then(console.log) | |
.catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment