Skip to content

Commit

Permalink
Firestore changes
Browse files Browse the repository at this point in the history
  • Loading branch information
met18001 committed Feb 5, 2020
1 parent c22fdea commit 0627cd5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions week-2/firestore.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,38 @@ <h1>My Shopping List App</h1>
<ul id="shopping-list">

</ul>
<script src="https://www.gstatic.com/firebasejs/7.8.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.8.0/firebase-firestore.js"></script>
<script>

// Initialize Cloud Firestore through Firebase
firebase.initializeApp({
apiKey: "AIzaSyBKiU2VOeD9Vwx4Fxt4_G1mbP-_pD-wHrk",
authDomain: "web3-3b002.firebaseapp.com",
databaseURL: "https://web3-3b002.firebaseio.com",
projectId: "web3-3b002",
storageBucket: "web3-3b002.appspot.com",
messagingSenderId: "45494778793",
appId: "1:45494778793:web:7cf73d66fd9ae2bfb1e2b8",
measurementId: "G-E35RWMSN0D"
});

var db = firebase.firestore();


var docRef = db.collection("shopping-lists").doc("OSjUoao3PR9BrMgQ8gjZ");

docRef.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});

const addBTn = document.getElementById('add');
const inputBox = document.getElementById('item');
const list = document.getElementById('shopping-list');
Expand Down

0 comments on commit 0627cd5

Please sign in to comment.