diff --git a/lib/edge/targeting.ts b/lib/edge/targeting.ts index 837c69e..3670964 100644 --- a/lib/edge/targeting.ts +++ b/lib/edge/targeting.ts @@ -26,8 +26,11 @@ type TargetingResponse = { const lmpidProvider = "loblawmedia.ca"; -async function Targeting(config: Required): Promise { - const response: TargetingResponse = await fetch("/v2/targeting", config, { +async function Targeting(config: Required, id: string): Promise { + const searchParams = new URLSearchParams({ id }); + const path = "/v2/targeting?" + searchParams.toString(); + + const response: TargetingResponse = await fetch(path, config, { method: "GET", headers: { Accept: "application/json" }, }); diff --git a/lib/sdk.ts b/lib/sdk.ts index 0d08f40..60c20a8 100644 --- a/lib/sdk.ts +++ b/lib/sdk.ts @@ -45,9 +45,9 @@ class OptableSDK { return Uid2Token(this.dcn, id); } - async targeting(): Promise { + async targeting(id: string = "__passport__"): Promise { await this.init; - return Targeting(this.dcn); + return Targeting(this.dcn, id); } targetingFromCache(): TargetingResponse | null {