Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
fix(bootstrap): config.id not updated when id is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGabriele committed Dec 17, 2017
1 parent af161dd commit 656d71a
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadScript, onAnalyticsReady, hasGoogleScript } from './helpers'
import config, { update } from './config'
import config from './config'
import createTrackers from './create-trackers'
import collectors from './collectors'
import untracked from 'lib/untracked'
Expand Down Expand Up @@ -38,21 +38,12 @@ export default function bootstrap () {
return onAnalyticsReady()
})
.then(() => {
let newId = id

if (typeof newId === 'function') {
newId = newId()
}

if (typeof newId.then === 'function') {
return newId.then(response => {
config.id = response
})
}

return newId
// see https://github.com/MatteoGabriele/vue-analytics/issues/78
return typeof id === 'function' ? id() : id
})
.then(response => {
.then(id => {
// Update the ID with the new value
config.id = id
// Create analytics trackers first
createTrackers()
// Add all collectors
Expand Down

0 comments on commit 656d71a

Please sign in to comment.