Skip to content

Commit

Permalink
Dev classifier workflow routing
Browse files Browse the repository at this point in the history
Add some simple workflow routing to the dev classifier, so that the location bar updates when the selected workflow changes.
  • Loading branch information
eatyourgreens committed Mar 29, 2022
1 parent 9530ecd commit 3f5d08d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/lib-classifier/dev/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,20 @@ class App extends React.Component {
}

selectWorkflow(event) {
const { value } = event.target
this.setState({ workflowID: value })
const { value: workflowID } = event.target
this.setState({ workflowID })
const url = new URL(window.location)
const { searchParams } = url
const newParams = new URLSearchParams()
for (const [key, value] of searchParams.entries()) {
newParams.set(key, value)
}
if (!workflowID) {
newParams.delete('workflow')
} else {
newParams.set('workflow', workflowID)
}
history.pushState(null, '', `/?${newParams.toString()}`)
}

toggleTheme () {
Expand Down

0 comments on commit 3f5d08d

Please sign in to comment.