Browse Source

add state ton sites

main
matthew 2 years ago
parent
commit
b0a978380d
  1. 1
      searching-front/app/core/pages/State/State.tsx
  2. 2
      searching-front/app/stateSites/queries/getHistoryOfSitesState.ts
  3. 4
      searching-front/pages/state.tsx

1
searching-front/app/core/pages/State/State.tsx

@ -4,6 +4,7 @@ import { useQuery } from "@blitzjs/rpc"
import { useState } from "react" import { useState } from "react"
import { useTranslation } from "react-i18next" import { useTranslation } from "react-i18next"
import { ChartData } from "chart.js/auto" import { ChartData } from "chart.js/auto"
import "chart.js/auto"
import getActualSitesState from "app/stateSites/queries/getActualSitesState" import getActualSitesState from "app/stateSites/queries/getActualSitesState"
import getHistoryOfSitesState from "app/stateSites/queries/getHistoryOfSitesState" import getHistoryOfSitesState from "app/stateSites/queries/getHistoryOfSitesState"

2
searching-front/app/stateSites/queries/getHistoryOfSitesState.ts

@ -1,6 +1,6 @@
import influxdb from "services/modules/influxdb" import influxdb from "services/modules/influxdb"
import { InfluxPeriod } from "services/modules/influxdb/types" import { InfluxPeriod } from "services/modules/influxdb/types"
export default async function getActualSitesState(period: InfluxPeriod = InfluxPeriod.W) { export default async function getActualSitesState(period: InfluxPeriod = InfluxPeriod.D) {
return await influxdb.getHistoryOfState(period) return await influxdb.getHistoryOfState(period)
} }

4
searching-front/pages/state.tsx

@ -44,7 +44,7 @@ const StatePage: BlitzPage<StatePageProps> = (props) => {
) )
} }
export const getStaticProps = gSP(async ({ params, ctx }): StaticPageProps<StatePageProps> => { export const getServerSideProps = async ({ params, ctx }): StaticPageProps<StatePageProps> => {
const actualState = await getActualSitesState(); const actualState = await getActualSitesState();
const historyOfState = await getHistoryOfSitesState(); const historyOfState = await getHistoryOfSitesState();
return { return {
@ -53,6 +53,6 @@ export const getStaticProps = gSP(async ({ params, ctx }): StaticPageProps<State
historyOfState historyOfState
}, },
} }
}) }
export default StatePage export default StatePage

Loading…
Cancel
Save