diff --git a/app/src/api/controllers/editHistoryController.ts b/app/src/api/controllers/editHistoryController.ts index 27d6a2a9..c266e7f5 100644 --- a/app/src/api/controllers/editHistoryController.ts +++ b/app/src/api/controllers/editHistoryController.ts @@ -6,7 +6,9 @@ import * as editHistoryService from '../services/editHistory'; const getGlobalEditHistory = asyncController(async (req: express.Request, res: express.Response) => { try { const result = await editHistoryService.getGlobalEditHistory(); - res.send(result); + res.send({ + history: result + }); } catch(error) { console.error(error); res.send({ error: 'Database error' }); diff --git a/app/src/frontend/app.tsx b/app/src/frontend/app.tsx index 684e9617..6d39803d 100644 --- a/app/src/frontend/app.tsx +++ b/app/src/frontend/app.tsx @@ -9,6 +9,7 @@ import MapApp from './map-app'; import { Building } from './models/building'; import { User } from './models/user'; import AboutPage from './pages/about'; +import ChangesPage from './pages/changes'; import ContactPage from './pages/contact'; import ContributorAgreementPage from './pages/contributor-agreement'; import DataAccuracyPage from './pages/data-accuracy'; @@ -112,6 +113,7 @@ class App extends React.Component { + ( { + const [history, setHistory] = useState(undefined); + + useEffect(() => { + const fetchData = async () => { + const res = await fetch(`/api/history`); + const data = await res.json(); + + setHistory(data.history); + }; + + fetchData(); + }, []); + + return ( +
+
+

Global edit history

+ +
    + {history && history.map(entry => ( +
  • + +
  • + ))} +
+
+
+ ); +}; + +export default ChangesPage;