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'
|
import { listenForLogin, listenForUser, User } from '../lib/firebase/users'
|
||||||
|
|
||||||
export const useUser = () => {
|
export const useUser = () => {
|
||||||
const [user, setUser] = useState<User | null>(null)
|
const [user, setUser] = useState<User | null | undefined>(undefined)
|
||||||
useEffect(() => listenForLogin(setUser), [])
|
useEffect(() => listenForLogin(setUser), [])
|
||||||
|
|
||||||
const userId = user?.id
|
const userId = user?.id
|
||||||
|
|
|
@ -64,7 +64,7 @@ export default function ContractPage() {
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<BetsSection contract={contract} user={user} />
|
<BetsSection contract={contract} user={user ?? null} />
|
||||||
</Col>
|
</Col>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default function NewContract() {
|
||||||
const creator = useUser()
|
const creator = useUser()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!creator) router.push('/')
|
if (creator === null) router.push('/')
|
||||||
})
|
})
|
||||||
|
|
||||||
const [initialProb, setInitialProb] = useState(50)
|
const [initialProb, setInitialProb] = useState(50)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user