web-manager 3.1.13 → 3.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/account.js +10 -14
- package/package.json +2 -2
package/lib/account.js
CHANGED
@@ -155,22 +155,18 @@ Account.prototype.resolve = function (account, options) {
|
|
155
155
|
var self = this;
|
156
156
|
return new Promise(function(resolve, reject) {
|
157
157
|
var currentUser = firebase.auth().currentUser;
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
162
|
-
firebase.firestore().doc('users/' + currentUser.uid)
|
163
|
-
.get()
|
164
|
-
.then(function (doc) {
|
165
|
-
return resolve(self._resolveAccount(currentUser, doc.data(), options));
|
166
|
-
})
|
167
|
-
.catch(reject)
|
168
|
-
} else {
|
169
|
-
if (!currentUser) {
|
170
|
-
return reject(new Error('No currently authenticated user'))
|
171
|
-
}
|
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) {
|
172
161
|
return resolve(self._resolveAccount(currentUser, account, options));
|
173
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
|
+
})
|
174
170
|
});
|
175
171
|
}
|
176
172
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.15",
|
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": {
|
@@ -28,4 +28,4 @@
|
|
28
28
|
"firebase": "^8.10.1",
|
29
29
|
"lazysizes": "^5.3.2"
|
30
30
|
}
|
31
|
-
}
|
31
|
+
}
|