Fix build and redirect logged out users from '/create' to '/'
This commit is contained in:
parent
f2d19360aa
commit
b9fb1d0f31
|
@ -1,5 +1,5 @@
|
|||
import router from 'next/router'
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { ContractsList } from '../components/contracts-list'
|
||||
import { Header } from '../components/header'
|
||||
|
@ -12,6 +12,10 @@ import { createContract } from '../lib/service/create-contract'
|
|||
export default function NewContract() {
|
||||
const creator = useUser()
|
||||
|
||||
useEffect(() => {
|
||||
if (!creator) router.push('/')
|
||||
})
|
||||
|
||||
const [initialProb, setInitialProb] = useState(50)
|
||||
const [question, setQuestion] = useState('')
|
||||
const [description, setDescription] = useState('')
|
||||
|
@ -34,6 +38,8 @@ export default function NewContract() {
|
|||
|
||||
const descriptionPlaceholder = `e.g. This market will resolve to “Yes” if, by June 2, 2021, 11:59:59 PM ET, Paxlovid (also known under PF-07321332)...`
|
||||
|
||||
if (!creator) return <></>
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header />
|
||||
|
|
Loading…
Reference in New Issue
Block a user