File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ export function GET(request: NextRequest) {
11
11
// Don't await just trigger
12
12
console . log ( 'youtube views triggered' ) ;
13
13
fetch ( publicURL ( ) + `/api/youtube/views` ,
14
- { headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` } } ) ;
14
+ {
15
+ method : 'POST' ,
16
+ headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` }
17
+ } ) ;
15
18
16
19
return Response . json ( { success : true } ) ;
17
20
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const sanityWriteClient = createClient({
11
11
useCdn : false
12
12
} ) ;
13
13
14
- export async function GET ( request : NextRequest ) {
14
+ export async function POST ( request : NextRequest ) {
15
15
const authHeader = request . headers . get ( 'authorization' ) ;
16
16
if ( authHeader !== `Bearer ${ process . env . CRON_SECRET } ` ) {
17
17
return new Response ( 'Unauthorized' , {
@@ -78,7 +78,10 @@ export async function GET(request: NextRequest) {
78
78
79
79
// Trigger next call, don't wait for response
80
80
fetch ( publicURL ( ) + `/api/youtube/views?lastId=${ lastId } ` ,
81
- { headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` } } ) ;
81
+ {
82
+ method : 'POST' ,
83
+ headers : { authorization : `Bearer ${ process . env . CRON_SECRET } ` }
84
+ } ) ;
82
85
83
86
return Response . json ( sanityUpdate ) ;
84
87
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments