dimanche 13 septembre 2020

can't able to retrieve data from firestore

this is my code , I want to retrieve data from firestore but there is an error occur(which is given below). how do i resolve this error or any other alternative option to retrieve data?.. Error:tasks.html:201 Uncaught ReferenceError: firebase is not defined at tasks.html:201

<script>
      // Your web app's Firebase configuration
    var firebaseConfig = {
        apiKey: "AIzaSyD_h_EWO8z7ODYoj47CiF4hzf5qnjqE2Rc",
        authDomain: "blocktask-ae24a.firebaseapp.com",
        databaseURL: "https://blocktask-ae24a.firebaseio.com",
        projectId: "blocktask-ae24a",
        storageBucket: "blocktask-ae24a.appspot.com",
        messagingSenderId: "665923751623",
        appId: "1:665923751623:web:c0726bb66583506dceb8e2",
        measurementId: "G-X8RKV7R4K9"
      };
      // Initialize Firebase
      firebase.initializeApp(firebaseConfig);
      firebase.analytics();
      db.collection("users").get().then(function(querySnapshot) {
        querySnapshot.forEach(function(doc) {
            // doc.data() is never undefined for query doc snapshots
            console.log(doc.id, " => ", doc.data());
        });
    });
    
    
    </script>
    
    <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase.js"></script>
    <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-analytics.js"></script>
    <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
    <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-database.js"></script>

enter image description here

enter image description here




Aucun commentaire:

Enregistrer un commentaire