[Vuejs]-How to add data to firebase subcollection with vuex action?

0👍

Vuex API

actions
type: { [type: string]: Function }

Register actions on the store. The handler function receives a context object that exposes the following properties:

{
state, // same as store.state, or local state if in modules
rootState, // same as store.state, only in modules
commit, // same as store.commit
dispatch, // same as store.dispatch
getters, // same as store.getters, or local getters if in modules
rootGetters // same as store.getters, only in modules
}
And also receives a second payload argument if there is one.

The issue is that I didn’t specified context.

0👍

replace this.demandId with demandId

createMeeting( meeting) {
      meeting.createdate = Timestamp.fromDate(new Date())
      const demandId = meeting.demandId
      console.log(demandId)
      return db
        .collection('demands')
        .doc(demandId)
        .collection('meetings')
        .add(meeting)
      },

Leave a comment