Fixed scenes breaking if no affiliate is available.
This commit is contained in:
parent
7702839b7a
commit
166f4ee7ce
|
|
@ -42,13 +42,17 @@ function getAffiliateUrl(scene) {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!scene.affiliate) {
|
||||
return watchUrl;
|
||||
}
|
||||
|
||||
if (scene.affiliate.url?.includes('/track')) { // nats redirect
|
||||
const { pathname, search } = new URL(watchUrl);
|
||||
|
||||
return `${scene.affiliate.url}${pathname}${search}`;
|
||||
}
|
||||
|
||||
if (scene.affiliate?.parameters) { // TODO: this is probably not getting tracked...
|
||||
if (scene.affiliate.parameters) { // TODO: this is probably not getting tracked...
|
||||
const newParams = new URLSearchParams({
|
||||
...Object.fromEntries(new URL(watchUrl).searchParams),
|
||||
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue