redirect signed out users on /profile and /trades to homepage

This commit is contained in:
mantikoros 2022-02-03 21:19:42 -06:00
parent 6914e5d706
commit b4a68bf436
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
import { PencilIcon } from '@heroicons/react/outline'
import Router from 'next/router'
import { AddFundsButton } from '../components/add-funds-button'
import { Page } from '../components/page'
@ -83,6 +84,11 @@ export default function ProfilePage() {
})
}
if (user === null) {
Router.replace('/')
return <></>
}
return (
<Page>
<SEO title="Profile" description="User profile settings" url="/profile" />

View File

@ -1,3 +1,5 @@
import Router from 'next/router'
import { BetsList } from '../components/bets-list'
import { Page } from '../components/page'
import { SEO } from '../components/SEO'
@ -7,6 +9,11 @@ import { useUser } from '../hooks/use-user'
export default function TradesPage() {
const user = useUser()
if (user === null) {
Router.replace('/')
return <></>
}
return (
<Page>
<SEO title="Your trades" description="Your trades" url="/trades" />