diff --git a/app/components/auth/index.tsx b/app/components/auth/index.tsx index 9f438f6..3eeeb25 100644 --- a/app/components/auth/index.tsx +++ b/app/components/auth/index.tsx @@ -4,12 +4,15 @@ import type { UserCredential } from "firebase/auth"; import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth"; import { useState } from "react"; import IconGoogle from "../svg/icon-google"; +import UnauthorizedDomain from "../error/UnauthorizedDomain"; export const LoginButton = ({ firebaseConfig }: any) => { const app = getApps().length === 0 ? initializeApp(firebaseConfig) : getApp(); // TODO error handling / web-api-key missing const auth = getAuth(app); + const [error, setError] = useState(null); + const submit = useSubmit(); const handleLogin = async () => { @@ -21,21 +24,26 @@ export const LoginButton = ({ firebaseConfig }: any) => { }); }, (error: any) => { - // TODO error handling / auth domain missing - throw new Error(error); + console.error(error); + setError(error); } ); }; return ( - + + ); }; diff --git a/app/components/error/UnauthorizedDomain.tsx b/app/components/error/UnauthorizedDomain.tsx new file mode 100644 index 0000000..0f18d66 --- /dev/null +++ b/app/components/error/UnauthorizedDomain.tsx @@ -0,0 +1,52 @@ +import { useState } from "react"; + +const UnauthorizedDomain = ({ projectId }: any) => { + const [open, setOpen] = useState(true); + if (!open) { + return null; + } + console.log(projectId); + return ( +
+
+
+
+

Unauthorized domain

+
+ If you are the app developer{" "} + + click here + {" "} + to whitelist domain +
+
+
+ + +
+
+ ); +}; + +export default UnauthorizedDomain; diff --git a/app/routes/roadmap/index.tsx b/app/routes/roadmap/index.tsx index 35121e0..429f042 100644 --- a/app/routes/roadmap/index.tsx +++ b/app/routes/roadmap/index.tsx @@ -90,7 +90,6 @@ export default function Items() { )} {errors.map((error: any) => { - console.log(error); if (error.code === 9) { return ; }