2017-05-29 47 views
1

未定義當我創建一個事件,我這樣做:失敗的第一個參數火力組包含在物業

enter image description here

後,當我嘗試更新goingNumber

export const eventCreate = ({ title, time, location }) => { 
    const newPostKey = firebase.database().ref('/events').push().key; 
    const update = {}; 

    const postDetails = { 
    eventId: newPostKey, 
    title, 
    ... 
    goingNumber: 1, 
    ... 
    }; 

    update[`/events/${newPostKey}`] = postDetails; 

    return (dispatch) => { 
    firebase.database().ref() 
     .update(update) 
     .then(() => { 
     dispatch({ type: EVENT_CREATE }); 
     }) 
     .then(() => newPostKey); 
    }; 
}; 
數據庫

export const eventSave = ({ goingNumber, eventId }) => {  
    return (dispatch) => { 
    firebase.database().ref(`/events/${eventId}`) 
     .set({ goingNumber }) 
     .then(() => { 
     dispatch({ type: EVENT_SAVE_SUCCESS }); 
     }); 
    }; 
}; 

我得到這個錯誤說:

enter image description here

回答

0

你不是一個值傳遞的goingNumber。我的猜測是你正在尋找

firebase.database().ref(`/events/${eventId}`) 
     .child('goingNumber').set(goingNumber) 
相關問題