File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export const fetchCache = 'force-no-store'
2+
13import { publicURL } from '@/lib/utils' ;
24import type { NextRequest } from 'next/server' ;
35
@@ -13,7 +15,10 @@ export function GET(request: NextRequest) {
1315 fetch ( publicURL ( ) + `/api/youtube/views` ,
1416 {
1517 method : 'POST' ,
16- headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` }
18+ headers : {
19+ authorization : `Bearer ${ process . env . CRON_SECRET } ` ,
20+ 'Cache-Control' : 'no-cache'
21+ }
1722 } ) ;
1823
1924 return Response . json ( { success : true } ) ;
Original file line number Diff line number Diff line change 1+ export const fetchCache = 'force-no-store'
2+
13import { publicURL , youtubeParser } from '@/lib/utils' ;
24import { createClient } from 'next-sanity' ;
35import type { NextRequest } from 'next/server' ;
@@ -41,7 +43,7 @@ export async function POST(request: NextRequest) {
4143 }
4244
4345 // These should never match, if they do bail.
44- if ( ! lastId && lastIdParam ) {
46+ if ( lastId === lastIdParam ) {
4547 console . error ( 'lastId matches current doc, stopping calls.' ) ;
4648 return new Response ( 'lastId matches current doc, stopping calls.' , { status : 200 } ) ;
4749 }
@@ -80,7 +82,10 @@ export async function POST(request: NextRequest) {
8082 fetch ( publicURL ( ) + `/api/youtube/views?lastId=${ lastId } ` ,
8183 {
8284 method : 'POST' ,
83- headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` }
85+ headers : {
86+ authorization : `Bearer ${ process . env . CRON_SECRET } ` ,
87+ 'Cache-Control' : 'no-cache'
88+ }
8489 } ) ;
8590
8691 return Response . json ( sanityUpdate ) ;
You can’t perform that action at this time.
0 commit comments