Skip to content

Commit

Permalink
add delete vatusa delete to solo
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcoombs2000 committed Aug 15, 2024
1 parent c3cce02 commit 5abb7d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/TrainingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5abb7d7

Please sign in to comment.