web-manager 3.1.13 → 3.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/account.js +19 -0
  2. package/package.json +1 -1
package/lib/account.js CHANGED
@@ -151,6 +151,25 @@ Account.prototype.delete = function (options) {
151
151
  });
152
152
  }
153
153
 
154
+ Account.prototype.resolve = function (account, options) {
155
+ var self = this;
156
+ return new Promise(function(resolve, reject) {
157
+ var currentUser = firebase.auth().currentUser;
158
+
159
+ // If there is no user logged in or we choose not to fetch the account, resolve a default account
160
+ if (!currentUser || !currentUser.uid || options.fetchNewAccount === false) {
161
+ return resolve(self._resolveAccount(currentUser, account, options));
162
+ }
163
+
164
+ // Otherwise, fetch the account from the database and resolve it
165
+ firebase.firestore().doc('users/' + currentUser.uid)
166
+ .get()
167
+ .then(function (doc) {
168
+ return resolve(self._resolveAccount(currentUser, doc.data(), options));
169
+ })
170
+ });
171
+ }
172
+
154
173
  Account.prototype.resolve = function (account, options) {
155
174
  var self = this;
156
175
  return new Promise(function(resolve, reject) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.1.13",
3
+ "version": "3.1.14",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {