add env
This commit is contained in:
parent
039197c5da
commit
6992099298
@ -14,7 +14,7 @@ pnpm dev
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
Open [http://3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
|
||||
@ -163,7 +163,8 @@ export const Timeline: React.FC<Props> = React.memo(({
|
||||
},
|
||||
onDateChange: async (date: Date) => {
|
||||
const datestr = formatInTimeZone(date, 'UTC', 'yyyyMMddHHmmss')
|
||||
const response = await fetch(`http://localhost:3050/api/v1/data/nearest?datetime=${datestr}&area=cn`)
|
||||
const url_base = process.env.GRAPHQL_BACKEND_URL || 'http://localhost:3050'
|
||||
const response = await fetch(`${url_base}/api/v1/data/nearest?datetime=${datestr}&area=cn`)
|
||||
|
||||
setTimelineTime(date)
|
||||
if (response.ok) {
|
||||
@ -241,7 +242,8 @@ export const Timeline: React.FC<Props> = React.memo(({
|
||||
|
||||
const date = new Date()
|
||||
const datestr = formatInTimeZone(date, 'UTC', 'yyyyMMddHHmmss')
|
||||
const response = await fetch(`http://localhost:3050/api/v1/data/nearest?datetime=${datestr}&area=cn`)
|
||||
const url_base = process.env.GRAPHQL_BACKEND_URL || 'http://localhost:3050'
|
||||
const response = await fetch(`${url_base}/api/v1/data/nearest?datetime=${datestr}&area=cn`)
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
const nearestDatetime = data.nearest_data_time
|
||||
|
||||
@ -58,7 +58,8 @@ export function MapComponent({
|
||||
useEffect(() => {
|
||||
if (!isMapReady || !currentDatetime) return;
|
||||
const utc_time_str = formatInTimeZone(currentDatetime, 'UTC', 'yyyyMMddHHmmss')
|
||||
const new_url = `http://localhost:3050/api/v1/data?datetime=${utc_time_str}&area=cn`
|
||||
const new_url_prefix = process.env.GRAPHQL_BACKEND_URL || 'http://localhost:3050'
|
||||
const new_url = `${new_url_prefix}/api/v1/data?datetime=${utc_time_str}&area=cn`
|
||||
fetchRadarTile(new_url)
|
||||
}, [currentDatetime, isMapReady])
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user