mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-23 06:36:43 +00:00
Adds a Main component
This commit is contained in:
parent
f81728fbce
commit
ab8da062af
11
React/src/pages/components/Main.js
Normal file
11
React/src/pages/components/Main.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const Main = ({ Component }) => {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center h-3/4">
|
||||||
|
<Component />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Main;
|
||||||
@ -1,28 +1,26 @@
|
|||||||
import React from 'react'
|
import React from 'react';
|
||||||
import { signinRedirect } from '../services/userService'
|
import { signinRedirect } from '../services/userService';
|
||||||
import { Redirect } from 'react-router-dom'
|
import { Redirect } from 'react-router-dom';
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux';
|
||||||
import Navbar from './components/Navbar'
|
import Navbar from './components/Navbar';
|
||||||
import VehicleRegisterForm from './components/VehicleRegisterForm'
|
import Main from './components/Main';
|
||||||
|
import VehicleRegisterForm from './components/VehicleRegisterForm';
|
||||||
|
|
||||||
function Login() {
|
function Login() {
|
||||||
const user = useSelector(state => state.auth.user)
|
const user = useSelector((state) => state.auth.user);
|
||||||
|
|
||||||
function login() {
|
function login() {
|
||||||
signinRedirect()
|
signinRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return user ? (
|
||||||
(user) ?
|
<Redirect to={'/'} />
|
||||||
(<Redirect to={'/'} />)
|
) : (
|
||||||
:
|
<div className="h-screen">
|
||||||
(
|
<Navbar />
|
||||||
<div>
|
<Main Component={VehicleRegisterForm} />
|
||||||
<Navbar />
|
</div>
|
||||||
<VehicleRegisterForm />
|
);
|
||||||
</div>
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Login
|
export default Login;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user