Skip to content

Commit

Permalink
chore: NIP
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Sep 15, 2024
1 parent deb84f5 commit 908eeba
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pages/Dashboard/GoogleAnalytics/Realtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ export const GoogleAnalyticsRealtime: React.FC<GoogleAnalyticsRealtimeProps> = (

const fetchRealtimeReports = () => {
window.clearTimeout(intervalId.current)
const request1 = fetchAnalyticsRealtimeReports(['minutesAgo']).then((response) => {
const timeRequest = fetchAnalyticsRealtimeReports(['minutesAgo']).then((response) => {
setTimelineReports(response.result.data.rows ?? [])
})
const request2 = fetchAnalyticsRealtimeReports(['countryId', 'city']).then((response) => {
setRegionReports(response.result.data.rows ?? [])
})
Promise.all([request1, request2]).then(() => {
const regionRequest = fetchAnalyticsRealtimeReports(['countryId', 'city']).then(
(response) => {
setRegionReports(response.result.data.rows ?? [])
}
)
Promise.all([timeRequest, regionRequest]).then(() => {
if (!isCanceled.current) {
intervalId.current = window.setTimeout(
fetchRealtimeReports,
Expand Down

0 comments on commit 908eeba

Please sign in to comment.