Commit ab5f0137 authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

aaaaaaaaa

parent 7e160f31
Loading
Loading
Loading
Loading
+32 −26
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ export const AuthContextProvider = ({ children }: AuthContextProviderProps) => {
  const [isLoading, setIsLoading] = useState(true);

  const checkSession = async () => {
    try {
      const user = await SecureStore.getItemAsync("user");
      const token = await SecureStore.getItemAsync("token");
      console.log(user);
@@ -61,7 +62,12 @@ export const AuthContextProvider = ({ children }: AuthContextProviderProps) => {
        }
        axios.defaults.headers.common["Authorization"] = `Bearer ${token}`;
      }
    } catch {
      console.log("Error checking session");
      setIsVerified(false);
    } finally {
      setIsLoading(false);
    }
  };

  const verify = async () => {
+26 −19
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ export const SetUpContextProvider = ({
      );
      setIsFirstTime(false);
    }
    setIsLoading(false);
  };

  const value = {
@@ -58,6 +59,7 @@ export const SetUpContextProvider = ({

  useEffect(() => {
    const checkFirstTime = async () => {
      try {
        if (isLoadingUser) return;
        if (!user) {
          setIsLoading(false);
@@ -78,7 +80,12 @@ export const SetUpContextProvider = ({
            JSON.stringify(emptyUserPreferences)
          );
        }
      } catch {
        console.log("Error checking session");
        setIsFirstTime(true);
      } finally {
        setIsLoading(false);
      }
    };

    checkFirstTime();