I am a beginner in Vue.js and I'm currently working on integrating Firebase with my Vue.js application. The app has two fields that I want to store in the Firebase database, but I keep encountering an error:
<template>
<div class="container">
<div class= "row">
<div class= "col-xs-12 co-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<h1>Http</h1>
<div class="form-group">
<label>Username</label>
<input type="text" class="form-control" v-model="username">
</div>
<div class="form-group">
<label>Mail</label>
<input type="text" class="form-control" v-model="email">
</div>
<button class="btn btn-primary" @click="submit">Submit</button>
</div>
</div>
</div>
</template>
<script>
import firebase from 'firebase'
var config = {
apiKey: "<your_api_key>",
authDomain: "<your_auth_domain>",
databaseURL: "<your_database_url>",
projectId: "<your_project_id>",
storageBucket: "<your_storage_bucket>",
messagingSenderId: "<your_messenger_id>"
};
firebase.initializeApp(config);
export default {
data() {
return{
username:'',
email:''
};
methods:{
submit(){
firebase.createUser(this.username, this.email)
.then((result) => {
console.log(result);
}).catch((err) => {
console.log(err)
});
}
}
}
The error message I'm receiving upon clicking the submit button is:
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_firebase___default.a.createUser is not a function
Can anyone provide guidance on how to resolve this error?