From 58c7e11d7a630cf6ea50af59c8900bc74394efe9 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Sat, 29 Jul 2023 13:39:20 +0200 Subject: [PATCH] Fixed checks on currentPassType --- examples/firebase/functions/src/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/firebase/functions/src/index.js b/examples/firebase/functions/src/index.js index c868c74..08c7c08 100644 --- a/examples/firebase/functions/src/index.js +++ b/examples/firebase/functions/src/index.js @@ -40,9 +40,7 @@ exports.pass = functions.https.onRequest(async (request, response) => { }, ); - let currentPassType = request.body.passType; - - if (currentPassType == "boardingPass") { + if (newPass.type == "boardingPass") { newPass.transitType = `PKTransitType${request.body.transitType}`; } @@ -89,7 +87,7 @@ exports.pass = functions.https.onRequest(async (request, response) => { key: `primary${i}`, label: field.label, value: - currentPassType == "boardingPass" + newPass.type == "boardingPass" ? field.value.toUpperCase() : field.value, }); @@ -153,7 +151,7 @@ exports.pass = functions.https.onRequest(async (request, response) => { } // Downloading thumbnail and logo files from Firebase Storage and adding to pass - if (currentPassType == "generic" || currentPassType == "eventTicket") { + if (newPass.type == "generic" || newPass.type == "eventTicket") { const thumbnailFile = request.body.thumbnailFile; const tempPath1 = path.join(os.tmpdir(), thumbnailFile); try {