From cc9a5d112a94abf992414872da6ef2802596e8a1 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Mon, 18 Mar 2019 15:01:01 -0700 Subject: [PATCH] added entrypoint param to fxa auth request --- app/user.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/user.js b/app/user.js index 1861fd56..b043bf96 100644 --- a/app/user.js +++ b/app/user.js @@ -94,10 +94,12 @@ export default class User { return this.loggedIn ? hashId(this.storage.id) : hashId(anonId); } - async startAuthFlow(source, utms = {}) { + async startAuthFlow(trigger, utms = {}) { + this.utms = utms; + this.trigger = trigger; try { const params = new URLSearchParams({ - entrypoint: `send-${source}`, + entrypoint: `send-${trigger}`, form_type: 'email', utm_source: utms.source || 'send', utm_campaign: utms.campaign || 'none' @@ -111,12 +113,10 @@ export default class User { const { flowId, flowBeginTime } = await res.json(); this.flowId = flowId; this.flowBeginTime = flowBeginTime; - this.utms = utms; } catch (e) { console.error(e); this.flowId = null; this.flowBeginTime = null; - this.utms = null; } } @@ -142,6 +142,9 @@ export default class User { options.flow_id = this.flowId; options.flow_begin_time = this.flowBeginTime; } + if (this.trigger) { + options.endpoint = `send-${this.trigger}`; + } if (this.utms) { options.utm_campaign = this.utms.campaign || 'none'; options.utm_content = this.utms.content || 'none';