fix newsletter api route

This commit is contained in:
Timothy Lin 2023-07-16 23:42:19 +08:00
parent 20704c9f75
commit f063d4d8b0
4 changed files with 91 additions and 20 deletions

View File

@ -0,0 +1,9 @@
import { NewsletterAPI } from 'pliny/newsletter'
import siteMetadata from '@/data/siteMetadata'
const handler = NewsletterAPI({
// @ts-ignore
provider: siteMetadata.newsletter.provider,
})
export { handler as GET, handler as POST }

View File

@ -1,14 +0,0 @@
import { NextResponse } from 'next/server'
import { NewsletterAPI } from 'pliny/newsletter'
import siteMetadata from '@/data/siteMetadata'
export async function POST(request: Request) {
const res = await request.json()
console.log(res) // { email: 'test@example.com' }
return NextResponse.json({ res })
// return NewsletterAPI({
// // @ts-ignore
// provider: siteMetadata.newsletter.provider,
// })
}

View File

@ -24,7 +24,7 @@
"next": "13.4.9",
"next-contentlayer": "0.3.4",
"next-themes": "^0.2.1",
"pliny": "0.1.0-beta.3",
"pliny": "0.1.0-beta.6",
"postcss": "^8.4.24",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@ -2124,6 +2124,18 @@ __metadata:
languageName: node
linkType: hard
"@giscus/react@npm:^2.3.0":
version: 2.3.0
resolution: "@giscus/react@npm:2.3.0"
dependencies:
giscus: ^1.3.0
peerDependencies:
react: ^16 || ^17 || ^18
react-dom: ^16 || ^17 || ^18
checksum: 2a0ed59f2b49d41ee6d326e356cdd91fe4d4a9e28b486fcb6679fbcb5bb840279da028cd117e3408d7dd0926c3ec2150c21faed615f56ae6e07229ca3275feff
languageName: node
linkType: hard
"@grpc/grpc-js@npm:^1.7.1":
version: 1.8.17
resolution: "@grpc/grpc-js@npm:1.8.17"
@ -2247,6 +2259,22 @@ __metadata:
languageName: node
linkType: hard
"@lit-labs/ssr-dom-shim@npm:^1.0.0, @lit-labs/ssr-dom-shim@npm:^1.1.0":
version: 1.1.1
resolution: "@lit-labs/ssr-dom-shim@npm:1.1.1"
checksum: 7a7add78e3ee570a7b987b9bf85e700b20d35d31c8b54cf4c8b2e3c8458ed4e2b0ff328706e5be7887f0ca8a02878c186e76609defb78f0d1b3c0e6b47c9f6ef
languageName: node
linkType: hard
"@lit/reactive-element@npm:^1.3.0, @lit/reactive-element@npm:^1.6.0":
version: 1.6.2
resolution: "@lit/reactive-element@npm:1.6.2"
dependencies:
"@lit-labs/ssr-dom-shim": ^1.0.0
checksum: 011a3ef0933fda86ec726d29ebc14e829e2f1ba23eca8ed8ed4d5c6f2a102c55cc6986000c5f4c8c3d0c549bc671f5d84d00ce91adc5bbd95970eec3662c0a92
languageName: node
linkType: hard
"@mailchimp/mailchimp_marketing@npm:^3.0.80":
version: 3.0.80
resolution: "@mailchimp/mailchimp_marketing@npm:3.0.80"
@ -3168,6 +3196,13 @@ __metadata:
languageName: node
linkType: hard
"@types/trusted-types@npm:^2.0.2":
version: 2.0.3
resolution: "@types/trusted-types@npm:2.0.3"
checksum: 4794804bc4a4a173d589841b6d26cf455ff5dc4f3e704e847de7d65d215f2e7043d8757e4741ce3a823af3f08260a8d04a1a6e9c5ec9b20b7b04586956a6b005
languageName: node
linkType: hard
"@types/unist@npm:*":
version: 3.0.0
resolution: "@types/unist@npm:3.0.0"
@ -5730,6 +5765,15 @@ __metadata:
languageName: node
linkType: hard
"giscus@npm:^1.3.0":
version: 1.3.0
resolution: "giscus@npm:1.3.0"
dependencies:
lit: ^2.7.5
checksum: e685c578fa0c0db4fb4f3dc3c30646a027b299fca3e5e9217f05ae75f6d7dc32c19a16d2e01cd770ceca55e6b008c47465d380dda3beb87723e1575bc59f7e69
languageName: node
linkType: hard
"github-slugger@npm:^1.4.0":
version: 1.5.0
resolution: "github-slugger@npm:1.5.0"
@ -7094,6 +7138,37 @@ __metadata:
languageName: node
linkType: hard
"lit-element@npm:^3.3.0":
version: 3.3.2
resolution: "lit-element@npm:3.3.2"
dependencies:
"@lit-labs/ssr-dom-shim": ^1.1.0
"@lit/reactive-element": ^1.3.0
lit-html: ^2.7.0
checksum: afe50825be05a8c83be418432dfed2f9a84ca1c6c1d1807e2090def9f94cc403dcbf832b338cdfe39cd168518664c02a6c7392868ca323e356e5744e3b4f45e6
languageName: node
linkType: hard
"lit-html@npm:^2.7.0":
version: 2.7.5
resolution: "lit-html@npm:2.7.5"
dependencies:
"@types/trusted-types": ^2.0.2
checksum: 7a54399f78c02f21ee5584fd9ff21b3edad8416df0aca22964bc5b221f0b57ba74d7bd98ad076acea2403b53b2ea87cc3eb47ba8395f371a645e3d584f2c1e49
languageName: node
linkType: hard
"lit@npm:^2.7.5":
version: 2.7.6
resolution: "lit@npm:2.7.6"
dependencies:
"@lit/reactive-element": ^1.6.0
lit-element: ^3.3.0
lit-html: ^2.7.0
checksum: 984a7fb9c0fa387f20177a07de22ea1c9cdc01a7dc7cb1c400d1df5b43a8956908460482a3259ea173555c6f0f13457d2ddc5c84d4c365007afd86e7ca58b384
languageName: node
linkType: hard
"loader-utils@npm:^2.0.0":
version: 2.0.4
resolution: "loader-utils@npm:2.0.4"
@ -8887,11 +8962,12 @@ __metadata:
languageName: node
linkType: hard
"pliny@npm:0.1.0-beta.3":
version: 0.1.0-beta.3
resolution: "pliny@npm:0.1.0-beta.3"
"pliny@npm:0.1.0-beta.6":
version: 0.1.0-beta.6
resolution: "pliny@npm:0.1.0-beta.6"
dependencies:
"@docsearch/react": ^3.5.0
"@giscus/react": ^2.3.0
"@mailchimp/mailchimp_marketing": ^3.0.80
contentlayer: ^0.3.4
copyfiles: ^2.4.1
@ -8907,7 +8983,7 @@ __metadata:
next: ">=13.0.0"
react: ^17.0.2 || ^18.0.0
react-dom: ^17.0.2 || ^18.0.0
checksum: 4a96a42db4c6f7a83ad720eca407d3a20a3297205b1df3dd08a5d032a381b5459b83aa068d20fc0a4caeefa7b669c7c2e725f6c718382b19d4b4f56bf5198c8c
checksum: 88c744d5134cff563d2ed5ebd33f085f2485d38ab31e1074c81de0a137842c3c8c2b636d626f813e73986bbcd3dc13b7343e2205e2f6582964d1ab2903d1cf3a
languageName: node
linkType: hard
@ -10678,7 +10754,7 @@ __metadata:
next: 13.4.9
next-contentlayer: 0.3.4
next-themes: ^0.2.1
pliny: 0.1.0-beta.3
pliny: 0.1.0-beta.6
postcss: ^8.4.24
prettier: ^2.8.8
prettier-plugin-tailwindcss: ^0.3.0