Skip to content

Commit

Permalink
Default behaviour for one active workflow
Browse files Browse the repository at this point in the history
For projects with one active workflow, use that as the workflow ID on the Classify page.
  • Loading branch information
eatyourgreens committed Jan 6, 2021
1 parent 128283d commit 079dffd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import getDefaultPageProps from '@helpers/getDefaultPageProps'

export async function getServerSideProps({ params, query, req, res }) {
const { subjectSetID, workflowID } = params
let { subjectSetID, workflowID } = params
const { props } = await getDefaultPageProps({ params, query, req, res })
const { project } = props.initialState
const activeWorkflows = project.links['active_workflows']
if (activeWorkflows.length === 1) {
[workflowID] = project.links['active_workflows']
}
if (subjectSetID) {
props.subjectSetID = subjectSetID
}
if (workflowID) {
props.workflowID = workflowID
} else {
props.workflowID = project?.configuration['default_workflow']
}
return ({ props })
}

0 comments on commit 079dffd

Please sign in to comment.