Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Cannot connect to Firebase's Firestore Database New Collection

I have a problem where I can connect my firebase database collection "Agricultures" but I cannot connect with the "Admins" collection. Here are some of my codes in my firebase file.

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
const AgriColRef = collection(db, "Agricultures");
export const AdminColRef = collection(db, "Admins");

export default AgriColRef; 

However, it returned with the error

[Vue warn]: Property "fname" was accessed during render but is not defined on instance.    
at <AddAdmin onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< null > >    
at <RouterView>    
at <App>

including for the other attributes.

Here is the code in the AddAdmin file

<script>
import { AdminColRef } from '../firebase';
import { addDoc } from 'firebase/firestore'

export default {
    dataAdmin(){
        return {
            fname:null,
            lnama:null,
            workerno:null,
        };
    },
    methods: {
        async createAdmin() {
            console.log("Create");
            const addedDoc = await addDoc(AdminColRef, this.$dataAdmin);
            console.log(addedDoc);
        }
    }
};
</script>

Next is in the router

import AddAdmin from '../components/admin/AddAdmin.vue'
const routes = [{
        path: '/add-admin',
        name: 'addAdmin',
        component: AddAdmin
    }]
const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router

And in the App file

<nav>
   <router-link to="/add-admin">Add Admin</router-link>
</nav>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!