0

I am having issues getting to store my data for 'players' into my team data. It does save with the team id but i want it to be nested inside of teams.

So I need the players to actually add on and be pusghed onto the empty 'players'...

enter image description here

My code from my VUEX store pushing to firebase is...

 firebase
        .database()
        .ref('teams/')
        .child(payload.id)
        .push(player)
        .then(user => {
          commit('updatePlayers', {
            players: payload.players
          });
        })
        .catch(error => {
          console.log(error);
        });
      // Reach out to firebase and store it      
    },

1 Answer 1

1

I believe it'll work if you put the full path of the reference upfront:

firebase.database()
  .ref(`teams/${payload.id}/players`)
  .push(player)
  // .then, .catch, etc.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.