0
votes

So I'm building mobile app via veu.js -> vuetify module using realtime database from firebase.

One of my views - Pract.vue need to retrive data from database.

<template>
  <div class="pa-6 text-center">
    <h1>Practice Mode</h1>
  </div>
</template>



<script>
import firebase from "firebase";
import "firebase/database";

var ref = firebase.database().ref("ang");


</script>

I added firebase.initializeApp(firebaseConfig); with data generated by firebase console to main.js file and import firebase from "firebase"

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify';
import firebase from "firebase";

// Xs in original code are real data

var firebaseConfig = {
    apiKey: "X",
    authDomain: "X",
    databaseURL: "X",
    projectId: "X",
    storageBucket: "X",
    messagingSenderId: "X",
    appId: "X",
    measurementId: "X"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);

Vue.config.productionTip = false

new Vue({
    router,
    store,
    vuetify,
    render: h => h(App)
}).$mount('#app')

Console alert Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).

I've tried import firebase from 'firebase/app' both in view and main.js -> same alert.

1

1 Answers

-1
votes

You need to call

firebase.initializeApp();

before any calls to firebase can be made