Files
warframe-center/app/pages/home/index.js
2022-03-13 22:49:28 +03:00

42 lines
761 B
JavaScript

import { Component } 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 Component {
constructor ({ scanResults }) {
super()
this.scanResults = scanResults
}
render () {
return (
<>
<Hero />
<Table
scanResults={this.scanResults}
/>
</>
)
}
}
export async function getServerSideProps () {
try {
await dbConnect()
const scanResults = await models.ScanResult.find({})
return {
props: {
scanResults: JSON.parse(JSON.stringify(scanResults))
}
}
} catch (e) {
console.error(e)
return {
props: {}
}
}
}