Merge pull request #294 from reuters-graphics/jon-referral-fetch
Don't fetch referrals on non-dotcom domains
This commit is contained in:
commit
e271c4342d
2 changed files with 8 additions and 0 deletions
5
.changeset/itchy-adults-cheer.md
Normal file
5
.changeset/itchy-adults-cheer.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@reuters-graphics/graphics-components': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Don't fetch referrals on non-dotcom domains
|
||||||
|
|
@ -67,6 +67,9 @@
|
||||||
let referrals: Article[] = $state([]);
|
let referrals: Article[] = $state([]);
|
||||||
|
|
||||||
const getReferrals = async () => {
|
const getReferrals = async () => {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
// fetch only reliably works on prod sites
|
||||||
|
if (window?.location?.hostname !== 'www.reuters.com') return;
|
||||||
const isCollection = Boolean(collection);
|
const isCollection = Boolean(collection);
|
||||||
const API = isCollection ? COLLECTION_API : SECTION_API;
|
const API = isCollection ? COLLECTION_API : SECTION_API;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue