File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ export const fetchCache = 'force-no-store'
2
+
1
3
import { publicURL } from '@/lib/utils' ;
2
4
import type { NextRequest } from 'next/server' ;
3
5
@@ -13,7 +15,10 @@ export function GET(request: NextRequest) {
13
15
fetch ( publicURL ( ) + `/api/youtube/views` ,
14
16
{
15
17
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
+ }
17
22
} ) ;
18
23
19
24
return Response . json ( { success : true } ) ;
Original file line number Diff line number Diff line change
1
+ export const fetchCache = 'force-no-store'
2
+
1
3
import { publicURL , youtubeParser } from '@/lib/utils' ;
2
4
import { createClient } from 'next-sanity' ;
3
5
import type { NextRequest } from 'next/server' ;
@@ -41,7 +43,7 @@ export async function POST(request: NextRequest) {
41
43
}
42
44
43
45
// These should never match, if they do bail.
44
- if ( ! lastId && lastIdParam ) {
46
+ if ( lastId === lastIdParam ) {
45
47
console . error ( 'lastId matches current doc, stopping calls.' ) ;
46
48
return new Response ( 'lastId matches current doc, stopping calls.' , { status : 200 } ) ;
47
49
}
@@ -80,7 +82,10 @@ export async function POST(request: NextRequest) {
80
82
fetch ( publicURL ( ) + `/api/youtube/views?lastId=${ lastId } ` ,
81
83
{
82
84
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
+ }
84
89
} ) ;
85
90
86
91
return Response . json ( sanityUpdate ) ;
You can’t perform that action at this time.
0 commit comments