Skip to content

Commit 991453f

Browse files
authored
Update index.js
1 parent 6ceac4f commit 991453f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

functions/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ admin.initializeApp();
55
const db = admin.database();
66
const tokenCache = new Map();
77

8-
exports.sendMoveNotification = onValueCreated('/moves/{moveId}', async (snapshot, context) => {
9-
const move = snapshot.val();
8+
exports.sendMoveNotification = onValueCreated('/moves/{moveId}', async event => {
9+
const move = event.data.val();
1010

1111
if (!move.friend) {
1212
console.log('No friend specified, skipping notification.');
@@ -34,7 +34,7 @@ exports.sendMoveNotification = onValueCreated('/moves/{moveId}', async (snapshot
3434
title: `It's your turn!`,
3535
body: move.move,
3636
},
37-
token: fcmToken,
37+
token: recipientToken,
3838
data: {
3939
player: move.player,
4040
}

0 commit comments

Comments
 (0)