diff --git a/src/App.tsx b/src/App.tsx
index 93a52d1..d86a028 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -26,7 +26,7 @@ const App: React.FC = () => {
const { initializeFromLocalStorge, login, isLoggedIn, name } = useAuthStore();
const { showProfile } = useShowProfileStore();
const { isLoading } = useLoadingStore();
-
+ const uuid = localStorage.getItem("uuid") || "";
useEffect(() => {
const auth = getAuth();
onAuthStateChanged(auth, (user1) => {
@@ -65,7 +65,7 @@ const App: React.FC = () => {
{
isLoading
?
- : !isLoggedIn
+ : uuid === ""
?
:name === ''
?
diff --git a/src/components/Auth.tsx b/src/components/Auth.tsx
index 4560d11..ae3c581 100644
--- a/src/components/Auth.tsx
+++ b/src/components/Auth.tsx
@@ -1,29 +1,29 @@
-/* eslint-disable @typescript-eslint/no-unused-vars */
-/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import {
- getAuth,
- getRedirectResult,
- GoogleAuthProvider,
- OAuthProvider,
- // onAuthStateChanged,
- signInWithRedirect,
-} from "firebase/auth";
+import { getAuth, getRedirectResult, GoogleAuthProvider, OAuthProvider, signInWithRedirect } from "firebase/auth";
import { FaApple } from "react-icons/fa";
import { FcGoogle } from "react-icons/fc";
-import { useLoadingStore } from "../store/useLoadingStore";
const Auth = () => {
const auth = getAuth();
const googleProvider = new GoogleAuthProvider();
const appleProvider = new OAuthProvider("apple.com");
- const { setLoading } = useLoadingStore();
-
+ appleProvider.addScope("email");
+ appleProvider.addScope("name");
const logIn = (auth: any, provider: any) => {
- void signInWithRedirect(auth, provider).then(() => {
- setLoading(true);
- });
- setLoading(true);
+ void signInWithRedirect(auth, provider)
+ localStorage.setItem("uuid", "something");
+ getRedirectResult(auth)
+ .then((result) => {
+ if (result !== null) {
+ localStorage.setItem("uuid", result.user.uid);
+ }
+ })
+ .catch((error) => {
+ const errorCode = error.code;
+ const errorMessage = error.message;
+ const email = error.email;
+ console.log(errorCode, errorMessage, email);
+ });
};
return (
diff --git a/src/store/authStore.tsx b/src/store/authStore.tsx
index 813f2e7..8e26102 100644
--- a/src/store/authStore.tsx
+++ b/src/store/authStore.tsx
@@ -39,7 +39,7 @@ export const useAuthStore = create((set) => ({
profile: "",
username: null,
email: "",
- name: "loading",
+ name: "",
token: "",
timetable: {},
regNo: "", // Initialize timetable as an empty object