Fix new button,

also redirects if user is not signed in
This commit is contained in:
Kurt Hutten
2020-11-10 20:37:04 +11:00
parent 32a0cff65b
commit 198c40132f
2 changed files with 12 additions and 4 deletions

View File

@@ -1,11 +1,16 @@
import { useEffect } from 'react'
import { useAuth } from '@redwoodjs/auth'
import { navigate, routes } from '@redwoodjs/router'
import MainLayout from 'src/layouts/MainLayout'
import Part2Cell from 'src/components/Part2Cell'
const NewPart2Page = ({userName}) => {
const { currentUser } = useAuth()
const { isAuthenticated, currentUser } = useAuth()
useEffect(() => {!isAuthenticated &&
navigate(routes.home())},
[currentUser])
return (
<MainLayout>
<Part2Cell