diff --git a/src/navigation/Router.tsx b/src/navigation/Router.tsx
index 666f487..0a1ece9 100644
--- a/src/navigation/Router.tsx
+++ b/src/navigation/Router.tsx
@@ -9,7 +9,6 @@ import { getWhitelabel } from "services/whiteLabel";
import Ventilation from "pages/VentEditor";
import { useGlobalState } from "providers";
import DeviceSupport from "pages/DeviceSupport";
-import Login from "pages/Login";
const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
const DevicePage = lazy(() => import("pages/Device"));
@@ -303,7 +302,7 @@ export default function Router() {
{/* Redirects */}
} />
- } />
+ {/* } /> */}
{/* } /> */}
{/* } /> */}
} />
diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx
index 661d1b9..3dc7d2f 100644
--- a/src/pages/Login.tsx
+++ b/src/pages/Login.tsx
@@ -1,26 +1,26 @@
import { RedirectLoginOptions, useAuth0 } from "@auth0/auth0-react";
// import { useAuth } from "hooks";
import queryString from "query-string";
-import { useCallback, useEffect } from "react";
+import { useEffect } from "react";
import { useLocation } from "react-router";
// import Loading from "./Loading";
import LoadingScreen from "app/LoadingScreen";
-interface Props {
- prevPath?: string;
-}
+// interface Props {
+// prevPath?: string;
+// }
-export default function Login(props: Props) {
- const { prevPath } = props;
+export default function Login() {
+ // const { prevPath } = props;
const location = useLocation();
const { loginWithRedirect } = useAuth0();
- const setRouteBeforeLogin = useCallback((): Promise => {
- return new Promise(function(resolve) {
- localStorage.setItem("routeBeforeLogin", prevPath ? prevPath : "/");
- return resolve("success");
- });
- }, [prevPath]);
+ // const setRouteBeforeLogin = useCallback((): Promise => {
+ // return new Promise(function(resolve) {
+ // localStorage.setItem("routeBeforeLogin", prevPath ? prevPath : "/");
+ // return resolve("success");
+ // });
+ // }, [prevPath]);
useEffect(() => {
const options: RedirectLoginOptions = {
@@ -33,6 +33,7 @@ export default function Login(props: Props) {
if (parsed.signup === "true") {
// if (options.authorizationParams) options.authorizationParams.screen_hint = "signup"; // 'signup' tells Auth0 to show the signup tab
options.authorizationParams!.screen_hint = "signup"; // 'signup' tells Auth0 to show the signup tab
+ options.authorizationParams!.prompt = "login";
}
if (parsed.email && parsed.email !== "") {
@@ -41,10 +42,11 @@ export default function Login(props: Props) {
}
}
- setRouteBeforeLogin().finally(() => {
- loginWithRedirect(options);
- });
- }, [location, loginWithRedirect, setRouteBeforeLogin]);
+ // setRouteBeforeLogin().finally(() => {
+ console.log(options.authorizationParams)
+ loginWithRedirect(options);
+ // });
+ }, [location, loginWithRedirect]);
// return ;
return ;
diff --git a/src/providers/auth.tsx b/src/providers/auth.tsx
index 2c412f8..d07cf81 100644
--- a/src/providers/auth.tsx
+++ b/src/providers/auth.tsx
@@ -15,7 +15,8 @@ export default function AuthWrapper(props: Props) {
useEffect(() => {
const url = new URL(window.location.href);
- const isManualLoginPage = url.pathname === "/login";
+ const isManualLoginPage = url.pathname.includes("/login");
+ console.log(url.pathname)
console.log(isManualLoginPage)
if (isManualLoginPage) {
@@ -26,12 +27,13 @@ export default function AuthWrapper(props: Props) {
let parsed = queryString.parse(url.search);
if (parsed.signup === "true") {
options.authorizationParams!.screen_hint = "signup";
+ options.authorizationParams!.prompt = "login";
}
if (parsed.email && parsed.email !== "") {
options.authorizationParams!.login_hint = parsed.email.toString(); // prefill email
}
- console.log(options)
+ console.log(options.authorizationParams)
loginWithRedirect(options)
} else if (!isAuthenticated && !isLoading) {