phase 1-6 implemented

This commit is contained in:
dimitar committed 2026-03-10 04:14:03 +01:00
1 parent 22c274bb83
commit 2c4927478a
73 files changed
+9702 -2354

No files matched your search

+10 -9
View File
@@ -13,6 +13,8 @@ import {
ScrollView,
} from "react-native";
import { OAuthButtons } from "../../components/auth/OAuthButtons";
import { getErrorMessage, getClerkErrorCode } from "../../utils/error-helpers";
import log from "../../utils/logger";
export default function SignInScreen() {
const { signIn, setActive, isLoaded } = useSignIn();
@@ -47,25 +49,24 @@ export default function SignInScreen() {
await setActive({ session: signInAttempt.createdSessionId });
router.replace("/(tabs)");
} else {
console.error(
"Sign-in incomplete:",
JSON.stringify(signInAttempt, null, 2),
);
log.warn("Sign-in incomplete", { status: signInAttempt.status });
setError("Sign-in incomplete. Please try again.");
}
} catch (err: any) {
console.error("Sign-in error:", JSON.stringify(err, null, 2));
} catch (err: unknown) {
log.error("Sign-in failed", err);
// Handle specific error codes
if (err.errors?.[0]?.code === "session_exists") {
if (getClerkErrorCode(err) === "session_exists") {
// User is already signed in, just redirect
router.replace("/(tabs)");
return;
}
setError(
err.errors?.[0]?.message ||
"Failed to sign in. Please check your credentials.",
getErrorMessage(
err,
"Failed to sign in. Please check your credentials.",
),
);
} finally {
setLoading(false);