File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ import { draftMode } from "next/headers" ;
2+ import { NextRequest , NextResponse } from "next/server" ;
3+
4+ export async function GET ( request : NextRequest ) {
5+ ( await draftMode ( ) ) . disable ( ) ;
6+ return NextResponse . redirect ( new URL ( "/" , request . url ) ) ;
7+ }
Original file line number Diff line number Diff line change 1+ import { defineEnableDraftMode } from "next-sanity/draft-mode" ;
2+ import { client } from "@/sanity/lib/client" ;
3+ import { token } from "@/sanity/lib/token" ;
4+
5+ export const { GET } = defineEnableDraftMode ( {
6+ client : client . withConfig ( { token } ) ,
7+ } ) ;
Original file line number Diff line number Diff line change 1+ import { Resend } from "resend" ;
2+
3+ const resend = new Resend ( process . env . RESEND_API_KEY ) ;
4+
5+ export const POST = async ( request : Request ) => {
6+ const { email } = await request . json ( ) ;
7+
8+ // Create contact
9+ try {
10+ resend . contacts . create ( {
11+ email,
12+ unsubscribed : false ,
13+ audienceId : process . env . RESEND_AUDIENCE_ID ! ,
14+ } ) ;
15+
16+ return Response . json ( { success : true } ) ;
17+ } catch ( error : any ) {
18+ return Response . json (
19+ { error : "Error subscribing to updates" } ,
20+ { status : 400 }
21+ ) ;
22+ }
23+ } ;
Original file line number Diff line number Diff line change 1+ /**
2+ * This route is responsible for the built-in authoring environment using Sanity Studio.
3+ * All routes under your studio path is handled by this file using Next.js' catch-all routes:
4+ * https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes
5+ *
6+ * You can learn more about the next-sanity package here:
7+ * https://github.com/sanity-io/next-sanity
8+ */
9+
10+ import { NextStudio } from 'next-sanity/studio'
11+ import config from '../../../sanity.config'
12+
13+ export const dynamic = 'force-static'
14+
15+ export { metadata , viewport } from 'next-sanity/studio'
16+
17+ export default function StudioPage ( ) {
18+ return < NextStudio config = { config } />
19+ }
You can’t perform that action at this time.
0 commit comments