From 1b7a0e79ef8c598b73a57e2d3c03090a660c89fc Mon Sep 17 00:00:00 2001 From: Ashwanth A R Date: Sun, 10 Jan 2021 00:50:09 +0530 Subject: [PATCH] auth: clicking on login navigates to dashboard --- auth/src/App.tsx | 8 ++++++-- auth/src/bootstrap.tsx | 4 ++-- auth/src/components/Login.tsx | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/auth/src/App.tsx b/auth/src/App.tsx index 98ed146..be34a20 100644 --- a/auth/src/App.tsx +++ b/auth/src/App.tsx @@ -17,14 +17,18 @@ const CardTitle = styled.h1` margin: 24px 0; `; -const App = () => { +interface AppProps { + login: VoidFunction; +} + +const App = ({ login }: AppProps) => { return ( Auth microfrontend (2 routes) - + diff --git a/auth/src/bootstrap.tsx b/auth/src/bootstrap.tsx index 5837d63..23bc719 100644 --- a/auth/src/bootstrap.tsx +++ b/auth/src/bootstrap.tsx @@ -5,10 +5,10 @@ import { createBrowserHistory } from "history"; import App from "./App"; -const mount = (el: Element, { history }: AuthMountOptions) => { +const mount = (el: Element, { history, login }: AuthMountOptions) => { ReactDOM.render( - + , el ); diff --git a/auth/src/components/Login.tsx b/auth/src/components/Login.tsx index 4b0d6bf..41e518a 100644 --- a/auth/src/components/Login.tsx +++ b/auth/src/components/Login.tsx @@ -4,9 +4,10 @@ import { Link } from "react-router-dom"; import Input from "./Input"; import { CardFooter, TabTitle } from "./styled"; -const Login = () => { +const Login = ({ login }: { login: VoidFunction }) => { const onLogin = useCallback(() => { - console.log("login"); + // verify details are correct (not implemented) and login + login(); }, []); return (