diff --git a/src/Firebase/CryptoKitties/KittiesService.js b/src/Firebase/CryptoKitties/KittiesService.js index af017d6..247b0db 100644 --- a/src/Firebase/CryptoKitties/KittiesService.js +++ b/src/Firebase/CryptoKitties/KittiesService.js @@ -104,14 +104,14 @@ export default new class KittiesService { }); } - async swipeRight(network, kittieId, studId, studImg, message, from) { - const payload = {msg: message, from, stud: studId, studImg, status: 'PENDING'}; + async swipeRight(network, kittieId, stud, msg, from) { + const payload = {msg, from, stud, status: 'PENDING'}; return db.collection('kitties') .doc('network') .collection(network) .doc(kittieId) .collection('swipeRight') - .doc(studId) + .doc(stud.id) .set(payload, { merge: true }); diff --git a/src/components/Chat.vue b/src/components/Chat.vue index a3027ff..e6ef288 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -86,13 +86,17 @@ console.log(`poke [[${pokeId}]] to kittie ${kittieId}`); }, swipeRight: async function (kittieId) { - const stud = this.kitties.userSelected; - const studImg = this.kitties.user.filter(kittie => kittie.id.toString() === stud)[0].image_url_png; - console.log('studImg', studImg); - const msg = `Hello treakle, want to breed with ${stud}?`; - await KittiesService.swipeRight('mainnet', kittieId, stud, studImg, msg, '0x401cBf2194D35D078c0BcdAe4BeA42275483ab5F'.toLowerCase()); - - console.log(`swipe right from ${stud} to ${kittieId}`); + const studId = this.kitties.userSelected; + const {image_url_png, name} = this.kitties.user.filter(kittie => kittie.id.toString() === studId)[0]; + const studPayload = { + id: studId, + studImg: image_url_png, + name + }; + const msg = `Want to breed with ${studPayload.name}?`; + await KittiesService.swipeRight('mainnet', kittieId, studPayload, msg, '0x401cBf2194D35D078c0BcdAe4BeA42275483ab5F'.toLowerCase()); + + console.log(`swipe right from ${studPayload.id} to ${kittieId}`); }, acceptRight: async function (kittieId, studId) { await KittiesService.matchKitties('mainnet', studId, kittieId);