staging #23
@ -25,8 +25,8 @@ import {
|
|||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { CheckboxField, InputError, InputField } from './Inputs'
|
import { CheckboxField, InputError, InputField } from './Inputs'
|
||||||
import { RelayController } from '../controllers'
|
import { RelayController } from '../controllers'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useLocation, useNavigate } from 'react-router-dom'
|
||||||
import { getModsInnerPageRoute } from '../routes'
|
import { appRoutes, getModsInnerPageRoute } from '../routes'
|
||||||
import { DownloadUrl, ModFormState, ModDetails } from '../types'
|
import { DownloadUrl, ModFormState, ModDetails } from '../types'
|
||||||
import { LoadingSpinner } from './LoadingSpinner'
|
import { LoadingSpinner } from './LoadingSpinner'
|
||||||
import { T_TAG_VALUE } from '../constants'
|
import { T_TAG_VALUE } from '../constants'
|
||||||
@ -55,6 +55,7 @@ type ModFormProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ModForm = ({ existingModData }: ModFormProps) => {
|
export const ModForm = ({ existingModData }: ModFormProps) => {
|
||||||
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const userState = useAppSelector((state) => state.user)
|
const userState = useAppSelector((state) => state.user)
|
||||||
|
|
||||||
@ -64,6 +65,12 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
|||||||
initializeFormState(existingModData)
|
initializeFormState(existingModData)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (location.pathname === appRoutes.submitMod) {
|
||||||
|
setFormState(initializeFormState())
|
||||||
|
}
|
||||||
|
}, [location.pathname]) // Only trigger when the pathname changes to submit-mod
|
||||||
|
|
||||||
const [formErrors, setFormErrors] = useState<FormErrors>({})
|
const [formErrors, setFormErrors] = useState<FormErrors>({})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user