mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Fix: update dependencies, remove sparkpost-node
This commit removes the sparkpost-node and switches to using a raw api call using fetch. This commit also updates the dependency react-email.
This commit is contained in:
1650
package-lock.json
generated
1650
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -21,9 +21,9 @@
|
|||||||
"@mapbox/search-js-react": "^1.0.0-beta.17",
|
"@mapbox/search-js-react": "^1.0.0-beta.17",
|
||||||
"@next/bundle-analyzer": "^13.4.10",
|
"@next/bundle-analyzer": "^13.4.10",
|
||||||
"@prisma/client": "^5.0.0",
|
"@prisma/client": "^5.0.0",
|
||||||
"@react-email/components": "^0.0.7",
|
"@react-email/components": "^0.0.11",
|
||||||
"@react-email/render": "^0.0.7",
|
"@react-email/render": "^0.0.9",
|
||||||
"@react-email/tailwind": "^0.0.8",
|
"@react-email/tailwind": "^0.0.12",
|
||||||
"@vercel/analytics": "^1.1.0",
|
"@vercel/analytics": "^1.1.0",
|
||||||
"argon2": "^0.31.1",
|
"argon2": "^0.31.1",
|
||||||
"cloudinary": "^1.41.0",
|
"cloudinary": "^1.41.0",
|
||||||
@@ -44,14 +44,13 @@
|
|||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-daisyui": "^4.0.0",
|
"react-daisyui": "^4.0.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-email": "^1.9.4",
|
"react-email": "^1.9.5",
|
||||||
"react-hook-form": "^7.45.2",
|
"react-hook-form": "^7.45.2",
|
||||||
"react-hot-toast": "^2.4.1",
|
"react-hot-toast": "^2.4.1",
|
||||||
"react-icons": "^4.10.1",
|
"react-icons": "^4.10.1",
|
||||||
"react-intersection-observer": "^9.5.2",
|
"react-intersection-observer": "^9.5.2",
|
||||||
"react-map-gl": "^7.1.2",
|
"react-map-gl": "^7.1.2",
|
||||||
"react-responsive-carousel": "^3.2.23",
|
"react-responsive-carousel": "^3.2.23",
|
||||||
"sparkpost": "^2.1.4",
|
|
||||||
"swr": "^2.2.0",
|
"swr": "^2.2.0",
|
||||||
"theme-change": "^2.5.0",
|
"theme-change": "^2.5.0",
|
||||||
"zod": "^3.21.4"
|
"zod": "^3.21.4"
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import SparkPost from 'sparkpost';
|
|
||||||
import { SPARKPOST_API_KEY } from '../env';
|
|
||||||
|
|
||||||
const client = new SparkPost(SPARKPOST_API_KEY);
|
|
||||||
|
|
||||||
export default client;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { SPARKPOST_SENDER_ADDRESS } from '../env';
|
import { SPARKPOST_API_KEY, SPARKPOST_SENDER_ADDRESS } from '../env';
|
||||||
import client from './client';
|
|
||||||
|
|
||||||
interface EmailParams {
|
interface EmailParams {
|
||||||
address: string;
|
address: string;
|
||||||
@@ -11,10 +10,26 @@ interface EmailParams {
|
|||||||
const sendEmail = async ({ address, text, html, subject }: EmailParams) => {
|
const sendEmail = async ({ address, text, html, subject }: EmailParams) => {
|
||||||
const from = SPARKPOST_SENDER_ADDRESS;
|
const from = SPARKPOST_SENDER_ADDRESS;
|
||||||
|
|
||||||
await client.transmissions.send({
|
const data = {
|
||||||
content: { from, html, subject, text },
|
|
||||||
recipients: [{ address }],
|
recipients: [{ address }],
|
||||||
|
content: { from, subject, text, html },
|
||||||
|
};
|
||||||
|
|
||||||
|
const transmissionsEndpoint = 'https://api.sparkpost.com/api/v1/transmissions';
|
||||||
|
|
||||||
|
const response = await fetch(transmissionsEndpoint, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
Authorization: SPARKPOST_API_KEY,
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (response.status !== 200) {
|
||||||
|
throw new Error(`Sparkpost API returned status code ${response.status}`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sendEmail;
|
export default sendEmail;
|
||||||
|
|||||||
Reference in New Issue
Block a user