Skip to content

Commit

Permalink
Consolidate server-side props
Browse files Browse the repository at this point in the history
Use screens/ClassifyPage/getServerSideProps to generate props for all pages under /classify.
  • Loading branch information
eatyourgreens committed Jan 6, 2021
1 parent c38850c commit 7986246
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export { default } from '@screens/ClassifyPage'

export function getServerSideProps({ params, req, res }) {
const { subjectID, subjectSetID, workflowID } = params
const props = { subjectID, subjectSetID, workflowID }
return ({ props })
}
export { default, getServerSideProps } from '@screens/ClassifyPage'
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export { default } from '@screens/ClassifyPage'

export function getServerSideProps({ params, req, res }) {
const { subjectID, workflowID } = params
const props = { subjectID, workflowID }
return ({ props })
}
export { default, getServerSideProps } from '@screens/ClassifyPage'
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import getDefaultPageProps from '@helpers/getDefaultPageProps'

export async function getServerSideProps({ params, query, req, res }) {
const { subjectSetID, workflowID } = params
const { subjectID, subjectSetID, workflowID } = params
const { props } = await getDefaultPageProps({ params, query, req, res })
const { project } = props.initialState
if (subjectID) {
props.subjectID = subjectID
}
if (subjectSetID) {
props.subjectSetID = subjectSetID
}
Expand Down

0 comments on commit 7986246

Please sign in to comment.