diff --git a/examples/for-tests-react-16/src/AppWithReactDomRouter.js b/examples/for-tests-react-16/src/AppWithReactDomRouter.js index 9078283be..5f4b7dd4b 100644 --- a/examples/for-tests-react-16/src/AppWithReactDomRouter.js +++ b/examples/for-tests-react-16/src/AppWithReactDomRouter.js @@ -16,29 +16,28 @@ import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpass import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui"; import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui"; -const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; -const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; +function AppWithReactDomRouter(props) { + const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; + const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; -let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -if (authRecipe === "thirdparty") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; -} else if (authRecipe === "emailpassword") { - recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -} else if (authRecipe === "both") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI]; -} else if (authRecipe === "thirdpartyemailpassword") { - recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; -} else if (authRecipe === "passwordless") { - recipePreBuiltUIList = [PasswordlessPreBuiltUI]; -} else if (authRecipe === "thirdpartypasswordless") { - recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; -} + let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + if (authRecipe === "thirdparty") { + recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; + } else if (authRecipe === "emailpassword") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + } else if (authRecipe === "both") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI]; + } else if (authRecipe === "thirdpartyemailpassword") { + recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; + } else if (authRecipe === "passwordless") { + recipePreBuiltUIList = [PasswordlessPreBuiltUI]; + } else if (authRecipe === "thirdpartypasswordless") { + recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; + } -if (emailVerificationMode !== "OFF") { - recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); -} - -function AppWithReactDomRouter(props) { + if (emailVerificationMode !== "OFF") { + recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); + } /** * For user context tests we add this query param so the additional routes * dont interfere with other tests diff --git a/examples/for-tests-react-16/src/AppWithReactDomRouterV5.js b/examples/for-tests-react-16/src/AppWithReactDomRouterV5.js index 5dd174087..a2ca47b9e 100644 --- a/examples/for-tests-react-16/src/AppWithReactDomRouterV5.js +++ b/examples/for-tests-react-16/src/AppWithReactDomRouterV5.js @@ -11,28 +11,28 @@ import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpass import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui"; import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui"; -const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; -const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; +function AppWithReactDomRouter(props) { + const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; + const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; -let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -if (authRecipe === "thirdparty") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; -} else if (authRecipe === "emailpassword") { - recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -} else if (authRecipe === "both") { - recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI]; -} else if (authRecipe === "thirdpartyemailpassword") { - recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; -} else if (authRecipe === "passwordless") { - recipePreBuiltUIList = [PasswordlessPreBuiltUI]; -} else if (authRecipe === "thirdpartypasswordless") { - recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; -} -if (emailVerificationMode !== "OFF") { - recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); -} + let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + if (authRecipe === "thirdparty") { + recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; + } else if (authRecipe === "emailpassword") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + } else if (authRecipe === "both") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI]; + } else if (authRecipe === "thirdpartyemailpassword") { + recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; + } else if (authRecipe === "passwordless") { + recipePreBuiltUIList = [PasswordlessPreBuiltUI]; + } else if (authRecipe === "thirdpartypasswordless") { + recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; + } + if (emailVerificationMode !== "OFF") { + recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); + } -function AppWithReactDomRouter(props) { return (
diff --git a/examples/for-tests-react-16/src/AppWithoutRouter.js b/examples/for-tests-react-16/src/AppWithoutRouter.js index c7b05bda6..f91419056 100644 --- a/examples/for-tests-react-16/src/AppWithoutRouter.js +++ b/examples/for-tests-react-16/src/AppWithoutRouter.js @@ -8,28 +8,6 @@ import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordle import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui"; import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/emailverification/prebuiltui"; -const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; -const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; - -let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -if (authRecipe === "thirdparty") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; -} else if (authRecipe === "emailpassword") { - recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -} else if (authRecipe === "both") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI]; -} else if (authRecipe === "thirdpartyemailpassword") { - recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; -} else if (authRecipe === "passwordless") { - recipePreBuiltUIList = [PasswordlessPreBuiltUI]; -} else if (authRecipe === "thirdpartypasswordless") { - recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; -} - -if (emailVerificationMode !== "OFF") { - recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); -} - function AppWithoutRouter() { return (
@@ -42,9 +20,30 @@ function AppWithoutRouter() { } function Routing() { - const [, setCurrentPath] = useState(window.location.pathname); + const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; + let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + if (authRecipe === "thirdparty") { + recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; + } else if (authRecipe === "emailpassword") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + } else if (authRecipe === "both") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI]; + } else if (authRecipe === "thirdpartyemailpassword") { + recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; + } else if (authRecipe === "passwordless") { + recipePreBuiltUIList = [PasswordlessPreBuiltUI]; + } else if (authRecipe === "thirdpartypasswordless") { + recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; + } + + if (emailVerificationMode !== "OFF") { + recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); + } + + const [, setCurrentPath] = useState(window.location.pathname); + useEffect(() => { const onLocationChange = () => { setCurrentPath(window.location.pathname); diff --git a/examples/for-tests/src/AppWithoutRouter.js b/examples/for-tests/src/AppWithoutRouter.js index bba918f1a..d769628c1 100644 --- a/examples/for-tests/src/AppWithoutRouter.js +++ b/examples/for-tests/src/AppWithoutRouter.js @@ -18,29 +18,30 @@ function AppWithoutRouter() {
); } -const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; -const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; -let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -if (authRecipe === "thirdparty") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; -} else if (authRecipe === "emailpassword") { - recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; -} else if (authRecipe === "both") { - recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI]; -} else if (authRecipe === "thirdpartyemailpassword") { - recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; -} else if (authRecipe === "passwordless") { - recipePreBuiltUIList = [PasswordlessPreBuiltUI]; -} else if (authRecipe === "thirdpartypasswordless") { - recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; -} +function Routing() { + const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword"; + const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; -if (emailVerificationMode !== "OFF") { - recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); -} + let recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + if (authRecipe === "thirdparty") { + recipePreBuiltUIList = [ThirdPartyPreBuiltUI]; + } else if (authRecipe === "emailpassword") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI]; + } else if (authRecipe === "both") { + recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI]; + } else if (authRecipe === "thirdpartyemailpassword") { + recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI]; + } else if (authRecipe === "passwordless") { + recipePreBuiltUIList = [PasswordlessPreBuiltUI]; + } else if (authRecipe === "thirdpartypasswordless") { + recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI]; + } + + if (emailVerificationMode !== "OFF") { + recipePreBuiltUIList.push(EmailVerificationPreBuiltUI); + } -function Routing() { const [, setCurrentPath] = useState(window.location.pathname); useEffect(() => {