File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,21 @@ import { NextRequest } from "next/server";
44export async function POST ( request : NextRequest ) {
55 const token = request . headers . get ( "authorization" ) ;
66
7- // Verify the request is legitimate
87 if ( token !== `Bearer ${ process . env . REVALIDATION_TOKEN } ` ) {
98 return new Response ( "Unauthorized" , { status : 401 } ) ;
109 }
1110
1211 try {
13- // Revalidate the home page and feed
1412 revalidatePath ( "/" , "page" ) ;
1513 revalidatePath ( "/feed" , "page" ) ;
1614
1715 return new Response ( "Revalidated" , { status : 200 } ) ;
18- } catch ( error ) {
19- return new Response ( "Error revalidating" , { status : 500 } ) ;
16+ } catch ( error : unknown ) {
17+ // Log the error and return a 500
18+ console . error ( "Revalidation error:" , error ) ;
19+ return new Response (
20+ `Error revalidating: ${ error instanceof Error ? error . message : "Unknown error" } ` ,
21+ { status : 500 } ,
22+ ) ;
2023 }
2124}
Original file line number Diff line number Diff line change 1- import { NextRequest } from "next/server" ;
21import { saveEntry } from "@/lib/store" ;
32import { ChangelogEntry } from "@/types/entry" ;
43
5- export async function POST ( request : NextRequest ) {
4+ export async function POST ( ) {
65 // Only allow in development
76 if ( process . env . NODE_ENV !== "development" ) {
87 return new Response ( "Test endpoint only available in development" , {
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ const MOCK_ENTRIES: ChangelogEntry[] = [
136136] ;
137137
138138// In-memory store for development
139- let devStore : ChangelogEntry [ ] = [ ] ;
139+ const devStore : ChangelogEntry [ ] = [ ] ;
140140
141141export async function saveEntry ( entry : ChangelogEntry ) {
142142 if ( process . env . NODE_ENV === "development" ) {
You can’t perform that action at this time.
0 commit comments