Fix create market redirect
This commit is contained in:
parent
8abbc34652
commit
eaa9651c82
|
@ -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
|
||||
|
|
|
@ -64,7 +64,7 @@ export default function ContractPage() {
|
|||
)}
|
||||
</Col>
|
||||
|
||||
<BetsSection contract={contract} user={user} />
|
||||
<BetsSection contract={contract} user={user ?? null} />
|
||||
</Col>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user