This commit is contained in:
2022-03-13 18:20:10 +03:00
parent 648af4f060
commit 9d6735bd40
10 changed files with 880 additions and 43 deletions

View File

@@ -1,6 +1,7 @@
import React from "react"
import React from 'react'
import dbConnect from '../../lib/dbConnect'
import { models } from 'shared-stuff'
import Hero from './Hero'
import Table from './Table'
export default class Home extends React.Component {
@@ -11,16 +12,17 @@ export default class Home extends React.Component {
render () {
return (
<div>
<>
<Hero />
<Table
scanResults={this.scanResults}
/>
</div>
</>
)
}
}
export async function getServerSideProps() {
export async function getServerSideProps () {
try {
await dbConnect()
const scanResults = await models.ScanResult.find({})
@@ -28,12 +30,12 @@ export async function getServerSideProps() {
return {
props: {
scanResults: JSON.parse(JSON.stringify(scanResults))
},
}
}
} catch (e) {
console.error(e)
return {
props: {},
props: {}
}
}
}