Reputation: 561
I try to write the user's token to the database, everything turns out for me except one, each new user overwrites the previous one. Tell me, please, what should be done to avoid this? thanks in advance
const today = new Date().getFullYear();
firebase.database().ref('users/' + today).set({
token: token,
});
Upvotes: 0
Views: 127
Reputation: 1660
Include userID in the ref
const today = new Date().getFullYear();
firebase.database().ref('users/' + uid + '/' + today).set({
token: token,
});
Upvotes: 1