I'm learning Vuejs while I'm creating a website for our store, and I have a problem connecting with Firebase, Authentication works fine, but CRUD doesn't, it gives me this error:
Uncaught SyntaxError: Unexpected reserved word (at Products.vue...)
Versions:
Code:
import { db } from '../main';
import { collection, addDoc } from "firebase/firestore";
export default {
name: "Products",
props: {
msg: String
},
data() {
return {
product: {
name: null,
price: null
}
}
},
methods: {
saveData() {
try {
const docRef = await addDoc(collection(db, "products"), this.product);
console.log("Document written with ID: ", docRef.id);
} catch (e) {
console.error("Error adding document: ", e);
}
}
}
};