File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,11 @@ export default async function CityPage({ params }: Props) {
4242 let timings : Record < string , string > | null = null ;
4343 let hijriDate : { day : string ; month : { en : string ; ar : string } ; year : string } | null = null ;
4444 try {
45- const url = `https://api.aladhan.com/v1/timings?latitude=${ city . latitude } &longitude=${ city . longitude } &method=${ city . method } ` ;
45+ // Use date in URL to avoid 302 redirect issues with caching
46+ const today = new Date ( )
47+ . toLocaleDateString ( 'en-GB' , { day : '2-digit' , month : '2-digit' , year : 'numeric' } )
48+ . replace ( / \/ / g, '-' ) ;
49+ const url = `https://api.aladhan.com/v1/timings/${ today } ?latitude=${ city . latitude } &longitude=${ city . longitude } &method=${ city . method } ` ;
4650 const res = await fetch ( url , { next : { revalidate : 3600 } } ) ;
4751 const j = await res . json ( ) ;
4852 if ( j . code === 200 ) {
You can’t perform that action at this time.
0 commit comments