39 lines
821 B
JavaScript
39 lines
821 B
JavaScript
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|
import { Component } from 'react'
|
|
import { models } from 'shared-stuff'
|
|
|
|
import dbConnect from '../../lib/dbConnect'
|
|
|
|
import Hero from './Hero'
|
|
import Table from './Table'
|
|
|
|
export default class Home extends Component {
|
|
constructor ({ scanResults }) {
|
|
super()
|
|
this.scanResults = scanResults
|
|
}
|
|
|
|
render () {
|
|
return (
|
|
<>
|
|
<Hero />
|
|
<Table
|
|
scanResults={this.scanResults}
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
}
|
|
|
|
export async function getServerSideProps ({ locale }) {
|
|
await dbConnect()
|
|
const scanResults = await models.ScanResult.find({})
|
|
|
|
return {
|
|
props: {
|
|
scanResults: JSON.parse(JSON.stringify(scanResults)),
|
|
...(await serverSideTranslations(locale, ['common', 'home']))
|
|
}
|
|
}
|
|
}
|