Skip to content

Commit

Permalink
Merge branch 'main' of github.com:michaelbrusegard/NiclasNordlundPhot…
Browse files Browse the repository at this point in the history
…ography

* 'main' of github.com:michaelbrusegard/NiclasNordlundPhotography:
  style: 🎨 format code with Prettier
  • Loading branch information
michaelbrusegard committed Sep 30, 2023
2 parents beefe53 + 3c40c73 commit 476e05d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions website/fileSharing.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function getArchivedPhotosUrl(purchasedItems) {
headers: {
Authorization: `Bearer ${idToken}`,
},
}
},
);
return response.data.url;
}
Expand All @@ -37,7 +37,7 @@ async function sendEmail(
photosUrl,
customerEmail,
customerName,
purchasedItems
purchasedItems,
) {
const transporter = nodemailer.createTransport({
service: "gmail",
Expand Down Expand Up @@ -100,7 +100,7 @@ function sendErrorEmails(
customerEmail,
customerName,
error,
retries = 5
retries = 5,
) {
// Email configuration
const transporter = nodemailer.createTransport({
Expand Down Expand Up @@ -157,21 +157,21 @@ function sendErrorEmails(
if (err) {
console.error(
`Error sending error email (attempt ${attempts}):`,
err
err,
);
if (attempts < retries) {
setTimeout(() => {
sendEmailWithRetry(attempts + 1);
}, 20000);
} else {
console.error(
"Max retry attempts reached. Email not sent."
"Max retry attempts reached. Email not sent.",
);
}
} else {
console.log("Error emails sent:", info.response);
}
}
},
);
}

Expand Down
6 changes: 3 additions & 3 deletions website/handlePurchase.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const webhookVerifyMiddleware = (request, response, next) => {
stripe.webhooks.constructEvent(
request.rawBody,
sigHeader,
webhookSecret
webhookSecret,
);
next();
} catch (error) {
Expand Down Expand Up @@ -46,7 +46,7 @@ const handleCheckoutSession = (req, res) => {
fileSharing.handlePhotos(
purchasedItems,
customerEmail,
customerName
customerName,
);

res.json({ received: true });
Expand All @@ -55,7 +55,7 @@ const handleCheckoutSession = (req, res) => {
purchasedItems,
customerEmail,
customerName,
error
error,
);
res.status(500).json({ error: e.message });
console.error(error);
Expand Down

0 comments on commit 476e05d

Please sign in to comment.