使用firebase cloud db时出现错误消息“解析函数触发器时出错”

时间:2019-06-16 13:02:10

标签: java html

我想使用firebase deploy部署我的网站,但是出现“解析函数触发器时出错”。

使用index.js文件 使用Atom编辑器 使用Firebase云数据库

index.js文件:

const form = document.querySelector('.cuisine')

const firebaseConfig = {
    apiKey: "AIzaSyAvT5IujYxk1OrRCR98rEx3IavTFYFVzyQ",
    authDomain: "continued-website.firebaseapp.com",
    databaseURL: "https://continued-website.firebaseio.com",
    projectId: "continued-website",
    storageBucket: "continued-website.appspot.com",
    messagingSenderId: "536508244959",
    appId: "1:536508244959:web:db9ef827a244ccf5"
};

function firebasePush(input) {
    //prevents from braking
    if (!firebase.apps.length) {
        firebase.initializeApp(config);
    }

    //push itself
    var recipesRef = firebase.database().ref('addRecipe').push().set({
        name: input.value
        user: input.user
        cuisine: input.cuisine
        time: input.time
        serving: input.serving
        ingredients;input.ingredients
        difficulty: input.difficulty
        procedure: input.procedure
        num_rating: 0,
        total_rating: 0
    });

    if (form) {
        form.addEventListener('submit', function (evt) {
            evt.preventDefault();
            firebasePush(inputname);
            //shows alert if everything went well.
            return alert('Data Successfully Sent to Realtime Database');
        })
    }
};

0 个答案:

没有答案