redirect signed out users on /profile and /trades to homepage
This commit is contained in:
parent
6914e5d706
commit
b4a68bf436
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { PencilIcon } from '@heroicons/react/outline'
|
import { PencilIcon } from '@heroicons/react/outline'
|
||||||
|
import Router from 'next/router'
|
||||||
|
|
||||||
import { AddFundsButton } from '../components/add-funds-button'
|
import { AddFundsButton } from '../components/add-funds-button'
|
||||||
import { Page } from '../components/page'
|
import { Page } from '../components/page'
|
||||||
|
@ -83,6 +84,11 @@ export default function ProfilePage() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user === null) {
|
||||||
|
Router.replace('/')
|
||||||
|
return <></>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<SEO title="Profile" description="User profile settings" url="/profile" />
|
<SEO title="Profile" description="User profile settings" url="/profile" />
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import Router from 'next/router'
|
||||||
|
|
||||||
import { BetsList } from '../components/bets-list'
|
import { BetsList } from '../components/bets-list'
|
||||||
import { Page } from '../components/page'
|
import { Page } from '../components/page'
|
||||||
import { SEO } from '../components/SEO'
|
import { SEO } from '../components/SEO'
|
||||||
|
@ -7,6 +9,11 @@ import { useUser } from '../hooks/use-user'
|
||||||
export default function TradesPage() {
|
export default function TradesPage() {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
|
if (user === null) {
|
||||||
|
Router.replace('/')
|
||||||
|
return <></>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<SEO title="Your trades" description="Your trades" url="/trades" />
|
<SEO title="Your trades" description="Your trades" url="/trades" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user