mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Add edit beer post, 500 page, and redirectIfLoggedIn getServerSideProps.
Implement edit beer post functionality. Register, edit and create beer post forms are now using the same layout found in components/ui/forms/BeerPostFormPageLayout. All forms are now extracted into their own components and are now found in components. Added redirectIfLoggedIn getServerSidesProp fn for login and register pages.
This commit is contained in:
@@ -1,27 +1,14 @@
|
||||
import { NextPage } from 'next';
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import Layout from '@/components/ui/Layout';
|
||||
import useUser from '@/hooks/useUser';
|
||||
import LoginForm from '@/components/Login/LoginForm';
|
||||
import Image from 'next/image';
|
||||
|
||||
import { FaUserCircle } from 'react-icons/fa';
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
import redirectIfLoggedIn from '@/getServerSideProps/redirectIfLoggedIn';
|
||||
|
||||
const LoginPage: NextPage = () => {
|
||||
const { user } = useUser();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
router.push(`/user/current`);
|
||||
}, [user, router]);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Head>
|
||||
@@ -65,3 +52,8 @@ const LoginPage: NextPage = () => {
|
||||
};
|
||||
|
||||
export default LoginPage;
|
||||
|
||||
export const getServerSideProps = redirectIfLoggedIn({
|
||||
destination: '/',
|
||||
permanent: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user