File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,16 +50,16 @@ export async function GET(request: Request) {
5050 const userData = await fetchGitHubContributions ( user , { bypassCache : refresh } ) ;
5151 const calendar = userData . calendar ;
5252 const stats = calculateStreak ( calendar , timezone ) ;
53- const headers = refresh
54- ? {
55- 'Cache-Control' : 'no-store, no-cache, must- revalidate' ,
56- Pragma : 'no-cache' ,
57- Expires : '0' ,
58- }
59- : {
60- // Cache until next UTC midnight; clients can bust with ?refresh=true
61- 'Cache-Control' : 'public, s-maxage=3600, stale-while-revalidate=86400' ,
62- } ;
53+ const headers = new Headers ( {
54+ // Cache until next UTC midnight; clients can bust with ?refresh=true
55+ 'Cache-Control' : 'public, s-maxage=3600, stale-while- revalidate=86400 ' ,
56+ } ) ;
57+
58+ if ( refresh ) {
59+ headers . set ( 'Cache-Control' , 'no-store, no-cache, must-revalidate' ) ;
60+ headers . set ( 'Pragma' , 'no-cache' ) ;
61+ headers . set ( 'Expires' , '0' ) ;
62+ }
6363
6464 return NextResponse . json (
6565 {
You can’t perform that action at this time.
0 commit comments