Initial prettier formatted files

This commit is contained in:
Dmitry Yankowski
2020-02-24 13:44:50 -05:00
parent 1543c990ca
commit 777e629b3d
83 changed files with 18556 additions and 19258 deletions

View File

@@ -1,22 +1,22 @@
import firebase from "firebase/app";
import "firebase/firestore";
import "firebase/auth";
import firebase from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'
// Initialize Firebase, copied from cloud console
const firebaseConfig = {
apiKey: "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM",
authDomain: "postwoman-api.firebaseapp.com",
databaseURL: "https://postwoman-api.firebaseio.com",
projectId: "postwoman-api",
storageBucket: "postwoman-api.appspot.com",
messagingSenderId: "421993993223",
appId: "1:421993993223:web:ec0baa8ee8c02ffa1fc6a2",
measurementId: "G-ERJ6025CEB"
};
firebase.initializeApp(firebaseConfig);
apiKey: 'AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM',
authDomain: 'postwoman-api.firebaseapp.com',
databaseURL: 'https://postwoman-api.firebaseio.com',
projectId: 'postwoman-api',
storageBucket: 'postwoman-api.appspot.com',
messagingSenderId: '421993993223',
appId: '1:421993993223:web:ec0baa8ee8c02ffa1fc6a2',
measurementId: 'G-ERJ6025CEB',
}
firebase.initializeApp(firebaseConfig)
// a reference to the users collection
const usersCollection = firebase.firestore().collection("users");
const usersCollection = firebase.firestore().collection('users')
// the shared state object that any vue component
// can get access to
@@ -34,21 +34,21 @@ export const fb = {
author_name: fb.currentUser.displayName,
author_image: fb.currentUser.photoURL,
message,
label
};
label,
}
usersCollection
.doc(fb.currentUser.uid)
.collection("feeds")
.collection('feeds')
.add(dt)
.catch(e => console.error("error inserting", dt, e));
.catch(e => console.error('error inserting', dt, e))
},
deleteFeed: id => {
usersCollection
.doc(fb.currentUser.uid)
.collection("feeds")
.collection('feeds')
.doc(id)
.delete()
.catch(e => console.error("error deleting", id, e));
.catch(e => console.error('error deleting', id, e))
},
writeSettings: async (setting, value) => {
const st = {
@@ -57,47 +57,47 @@ export const fb = {
author_name: fb.currentUser.displayName,
author_image: fb.currentUser.photoURL,
name: setting,
value
};
value,
}
usersCollection
.doc(fb.currentUser.uid)
.collection("settings")
.collection('settings')
.doc(setting)
.set(st)
.catch(e => console.error("error updating", st, e));
.catch(e => console.error('error updating', st, e))
},
writeHistory: async entry => {
const hs = entry;
const hs = entry
usersCollection
.doc(fb.currentUser.uid)
.collection("history")
.collection('history')
.add(hs)
.catch(e => console.error("error inserting", hs, e));
.catch(e => console.error('error inserting', hs, e))
},
deleteHistory: entry => {
usersCollection
.doc(fb.currentUser.uid)
.collection("history")
.collection('history')
.doc(entry.id)
.delete()
.catch(e => console.error("error deleting", entry, e));
.catch(e => console.error('error deleting', entry, e))
},
clearHistory: () => {
usersCollection
.doc(fb.currentUser.uid)
.collection("history")
.collection('history')
.get()
.then(({ docs }) => {
docs.forEach(e => fb.deleteHistory(e));
});
docs.forEach(e => fb.deleteHistory(e))
})
},
toggleStar: (entry, value) => {
usersCollection
.doc(fb.currentUser.uid)
.collection("history")
.collection('history')
.doc(entry.id)
.update({ star: value })
.catch(e => console.error("error deleting", entry, e));
.catch(e => console.error('error deleting', entry, e))
},
writeCollections: async collection => {
const cl = {
@@ -105,14 +105,14 @@ export const fb = {
author: fb.currentUser.uid,
author_name: fb.currentUser.displayName,
author_image: fb.currentUser.photoURL,
collection: collection
};
collection: collection,
}
usersCollection
.doc(fb.currentUser.uid)
.collection("collections")
.doc("sync")
.collection('collections')
.doc('sync')
.set(cl)
.catch(e => console.error("error updating", cl, e));
.catch(e => console.error('error updating', cl, e))
},
writeEnvironments: async environment => {
const ev = {
@@ -120,21 +120,21 @@ export const fb = {
author: fb.currentUser.uid,
author_name: fb.currentUser.displayName,
author_image: fb.currentUser.photoURL,
environment: environment
};
environment: environment,
}
usersCollection
.doc(fb.currentUser.uid)
.collection("environments")
.doc("sync")
.collection('environments')
.doc('sync')
.set(ev)
.catch(e => console.error("error updating", ev, e));
}
};
.catch(e => console.error('error updating', ev, e))
},
}
// When a user logs in or out, save that in the store
firebase.auth().onAuthStateChanged(user => {
if (user) {
fb.currentUser = user;
fb.currentUser = user
fb.currentUser.providerData.forEach(profile => {
let us = {
updatedOn: new Date(),
@@ -142,80 +142,80 @@ firebase.auth().onAuthStateChanged(user => {
name: profile.displayName,
email: profile.email,
photoUrl: profile.photoURL,
uid: profile.uid
};
uid: profile.uid,
}
usersCollection
.doc(fb.currentUser.uid)
.set(us)
.catch(e => console.error("error updating", us, e));
});
.catch(e => console.error('error updating', us, e))
})
usersCollection
.doc(fb.currentUser.uid)
.collection("feeds")
.orderBy("createdOn", "desc")
.collection('feeds')
.orderBy('createdOn', 'desc')
.onSnapshot(feedsRef => {
const feeds = [];
const feeds = []
feedsRef.forEach(doc => {
const feed = doc.data();
feed.id = doc.id;
feeds.push(feed);
});
fb.currentFeeds = feeds;
});
const feed = doc.data()
feed.id = doc.id
feeds.push(feed)
})
fb.currentFeeds = feeds
})
usersCollection
.doc(fb.currentUser.uid)
.collection("settings")
.collection('settings')
.onSnapshot(settingsRef => {
const settings = [];
const settings = []
settingsRef.forEach(doc => {
const setting = doc.data();
setting.id = doc.id;
settings.push(setting);
});
fb.currentSettings = settings;
});
const setting = doc.data()
setting.id = doc.id
settings.push(setting)
})
fb.currentSettings = settings
})
usersCollection
.doc(fb.currentUser.uid)
.collection("history")
.collection('history')
.onSnapshot(historyRef => {
const history = [];
const history = []
historyRef.forEach(doc => {
const entry = doc.data();
entry.id = doc.id;
history.push(entry);
});
fb.currentHistory = history;
});
const entry = doc.data()
entry.id = doc.id
history.push(entry)
})
fb.currentHistory = history
})
usersCollection
.doc(fb.currentUser.uid)
.collection("collections")
.collection('collections')
.onSnapshot(collectionsRef => {
const collections = [];
const collections = []
collectionsRef.forEach(doc => {
const collection = doc.data();
collection.id = doc.id;
collections.push(collection);
});
fb.currentCollections = collections[0].collection;
});
const collection = doc.data()
collection.id = doc.id
collections.push(collection)
})
fb.currentCollections = collections[0].collection
})
usersCollection
.doc(fb.currentUser.uid)
.collection("environments")
.collection('environments')
.onSnapshot(environmentsRef => {
const environments = [];
const environments = []
environmentsRef.forEach(doc => {
const environment = doc.data();
environment.id = doc.id;
environments.push(environment);
});
fb.currentEnvironments = environments[0].environment;
});
const environment = doc.data()
environment.id = doc.id
environments.push(environment)
})
fb.currentEnvironments = environments[0].environment
})
} else {
fb.currentUser = null;
fb.currentUser = null
}
});
})