Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Handle remembered users not to show them login form

dominik-zeglenf11a551dadc5
diff --git a/saleor/static/dashboard-next/auth/components/LoginLoading/LoginLoading.tsx b/saleor/static/dashboard-next/auth/components/LoginLoading/LoginLoading.tsx
new file mode 100644
index 0000000000..3850aba603
--- /dev/null
+++ b/saleor/static/dashboard-next/auth/components/LoginLoading/LoginLoading.tsx
@@ -0,0 +1,19 @@
+import CircularProgress from "@material-ui/core/CircularProgress";
+import { withStyles } from "@material-ui/core/styles";
+import * as React from "react";
+
+const decorate = withStyles({
+ root: {
+ alignItems: "center" as "center",
+ display: "flex" as "flex",
+ height: "100vh",
+ justifyContent: "center" as "center"
+ }
+});
+const LoginLoading = decorate<{}>(({ classes }) => (
+ <div className={classes.root}>
+ <CircularProgress size={128} />
+ </div>
+));
+LoginLoading.displayName = "LoginLoading";
+export default LoginLoading;
diff --git a/saleor/static/dashboard-next/auth/components/LoginLoading/index.ts b/saleor/static/dashboard-next/auth/components/LoginLoading/index.ts
new file mode 100644
index 0000000000..eaeb4c4121
--- /dev/null
+++ b/saleor/static/dashboard-next/auth/components/LoginLoading/index.ts
@@ -0,0 +1,2 @@
+export { default } from "./LoginLoading";
+export * from "./LoginLoading";
diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsx
index 271dcb1350..5ddfab2749 100644
--- a/saleor/static/dashboard-next/index.tsx
+++ b/saleor/static/dashboard-next/index.tsx
@@ -14,6 +14,7 @@ import * as Cookies from "universal-cookie";
import AppRoot from "./AppRoot";
import Auth, { getAuthToken, removeAuthToken } from "./auth";
import AuthProvider from "./auth/AuthProvider";
+import LoginLoading from "./auth/components/LoginLoading/LoginLoading";
import CategorySection from "./categories";
import { DateProvider } from "./components/DateFormatter";
import { LocaleProvider } from "./components/Locale";
@@ -103,7 +104,7 @@ render(
</Switch>
</AppRoot>
) : hasToken && tokenVerifyLoading ? (
- <>loading</>
+ <LoginLoading />
) : (
<Auth loading={tokenAuthLoading} />
);
diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.js
index d69a5f243c..004027fa2c 100644
--- a/saleor/static/dashboard-next/storybook/config.js
+++ b/saleor/static/dashboard-next/storybook/config.js
@@ -32,6 +32,7 @@ function loadStories() {
// Authentication
require("./stories/auth/LoginPage");
+ require("./stories/auth/LoginLoading");
// Categories
require("./stories/categories/CategoryDeleteDialog");
diff --git a/saleor/static/dashboard-next/storybook/stories/auth/LoginLoading.tsx b/saleor/static/dashboard-next/storybook/stories/auth/LoginLoading.tsx
new file mode 100644
index 0000000000..497def5ddf
--- /dev/null
+++ b/saleor/static/dashboard-next/storybook/stories/auth/LoginLoading.tsx
@@ -0,0 +1,9 @@
+import { storiesOf } from "@storybook/react";
+import * as React from "react";
+
+import LoginLoading from "../../../auth/components/LoginLoading";
+import Decorator from "../../Decorator";
+
+storiesOf("Views / Authentication / Verifying remembered user", module)
+ .addDecorator(Decorator)
+ .add("default", () => <LoginLoading />);