diff --git a/src/App.tsx b/src/App.tsx index 1f5cd9c..69061c2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,6 +7,7 @@ import {setInterval} from "timers"; interface IAppState { passages: ILigne[]; + refreshDate?: string; } class App extends React.Component<{}, IAppState> { @@ -15,13 +16,13 @@ class App extends React.Component<{}, IAppState> { constructor(props: {}) { super(props); - this.state = {passages: [{ligne: undefined, delais: [undefined]}]}; this.timerId = undefined; const urlParams = new URLSearchParams(window.location.search); this.refreshSeconds = Number(urlParams.get("refreshSeconds")); if (this.refreshSeconds <= 5) { this.refreshSeconds = 60; } + this.state = {passages: [{ligne: undefined, delais: [undefined]}]}; } render() { @@ -40,7 +41,7 @@ class App extends React.Component<{}, IAppState> { ; @@ -61,6 +62,7 @@ class App extends React.Component<{}, IAppState> { const headers = new Headers(); headers.set("Authorization", `Basic ${process.env.REACT_APP_TCL_AUTH}`); http("https://tcl.augendre.info/stop/290", {method: "GET", headers: headers}).then(json => { + json.refreshDate = new Date().toLocaleString("fr-fr"); this.setState(json); }); }