added entrypoint param to fxa auth request
This commit is contained in:
parent
122867b926
commit
cc9a5d112a
1 changed files with 7 additions and 4 deletions
11
app/user.js
11
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';
|
||||
|
|
Loading…
Reference in a new issue