mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-31 18:50:14 +02:00
db:jss: prettify
This commit is contained in:
17
src/db.js
17
src/db.js
@@ -106,13 +106,16 @@
|
||||
|
||||
async function getUser(userId) {
|
||||
const remoteDb = await getDb();
|
||||
return remoteDb.doc(`users/${userId}`).get().then(doc => {
|
||||
if (!doc.exists)
|
||||
return remoteDb.doc(`users/${userId}`).set({}, { merge: true });
|
||||
const user = doc.data();
|
||||
Object.assign(window.user, user);
|
||||
return user;
|
||||
});
|
||||
return remoteDb
|
||||
.doc(`users/${userId}`)
|
||||
.get()
|
||||
.then(doc => {
|
||||
if (!doc.exists)
|
||||
return remoteDb.doc(`users/${userId}`).set({}, { merge: true });
|
||||
const user = doc.data();
|
||||
Object.assign(window.user, user);
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
// Fetch user settings.
|
||||
|
Reference in New Issue
Block a user