From 5abb7d765777c180d88d2f2db122c73b7c4fa692 Mon Sep 17 00:00:00 2001 From: Tom Coombs Date: Thu, 15 Aug 2024 19:24:28 -0400 Subject: [PATCH] add delete vatusa delete to solo --- controllers/TrainingController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/TrainingController.js b/controllers/TrainingController.js index cafec84..ff07183 100644 --- a/controllers/TrainingController.js +++ b/controllers/TrainingController.js @@ -454,10 +454,13 @@ async (req, res) => { var indexToDelete; // Find the index of 'twrs' in the array - if (pos === 'TWR') indexToDelete = updateUser.certCodes.indexOf('twrs'); + if (pos === 'TWR') indexToDelete = updateUser.certCodes.indexOf('twrs'); else if (pos === 'APP') indexToDelete = updateUser.certCodes.indexOf('apps'); else if (pos === 'CTR') indexToDelete = updateUser.certCodes.indexOf('miazmas'); + if (pos === 'APP' || app=== 'CTR') + await axios.post(`https://api.vatusa.net/v2/solo?cid=${req.params.id}&position=${req.body.position}&apikey=${process.env.VATUSA_API_KEY}`) + // Check if index is found in the array if (indexToDelete !== -1) updateUser.certCodes.splice(indexToDelete, 1);