Fix create market redirect

This commit is contained in:
jahooma 2021-12-16 01:00:35 -06:00
parent 8abbc34652
commit eaa9651c82
3 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { listenForLogin, listenForUser, User } from '../lib/firebase/users'
export const useUser = () => {
const [user, setUser] = useState<User | null>(null)
const [user, setUser] = useState<User | null | undefined>(undefined)
useEffect(() => listenForLogin(setUser), [])
const userId = user?.id

View File

@ -64,7 +64,7 @@ export default function ContractPage() {
)}
</Col>
<BetsSection contract={contract} user={user} />
<BetsSection contract={contract} user={user ?? null} />
</Col>
)
}

View File

@ -13,7 +13,7 @@ export default function NewContract() {
const creator = useUser()
useEffect(() => {
if (!creator) router.push('/')
if (creator === null) router.push('/')
})
const [initialProb, setInitialProb] = useState(50)