mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
added step route to publish
This commit is contained in:
parent
9ebddd814d
commit
8f34bf742a
@ -1,4 +1,5 @@
|
||||
import { ReactElement, useEffect } from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useFormikContext } from 'formik'
|
||||
import { wizardSteps, initialPublishFeedback } from './_constants'
|
||||
import { useWeb3 } from '@context/Web3'
|
||||
@ -11,6 +12,7 @@ export function Steps({
|
||||
}): ReactElement {
|
||||
const { chainId, accountId } = useWeb3()
|
||||
const { values, setFieldValue } = useFormikContext<FormPublishData>()
|
||||
const router = useRouter()
|
||||
|
||||
// auto-sync user chainId & account into form data values
|
||||
useEffect(() => {
|
||||
@ -43,9 +45,20 @@ export function Steps({
|
||||
})
|
||||
}, [values.pricing.type, setFieldValue])
|
||||
|
||||
const { component } = wizardSteps.filter(
|
||||
(stepContent) => stepContent.step === values.user.stepCurrent
|
||||
)[0]
|
||||
useEffect(() => {
|
||||
// Change route to include steps
|
||||
router.push(
|
||||
`${router.pathname}/?step=${values.user.stepCurrent}`,
|
||||
undefined,
|
||||
{
|
||||
shallow: true
|
||||
}
|
||||
)
|
||||
}, [values.user.stepCurrent])
|
||||
|
||||
const { component } = wizardSteps.filter((stepContent) => {
|
||||
return stepContent.step === values.user.stepCurrent
|
||||
})[0]
|
||||
|
||||
return component
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user