From 3273e7a0fbbce82f4ce6cacbcdb7b6d6848f6c1b Mon Sep 17 00:00:00 2001
From: JustZvan <justzvan@justzvan.xyz>
Date: Mon, 6 Apr 2026 15:32:51 +0200
Subject: feat: gallery scanning preferences

---
 lib/auth.tsx | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'lib/auth.tsx')

diff --git a/lib/auth.tsx b/lib/auth.tsx
index b05c6a7..ac394f4 100644
--- a/lib/auth.tsx
+++ b/lib/auth.tsx
@@ -1,9 +1,9 @@
 import {
-  createContext,
-  ReactNode,
-  useContext,
-  useEffect,
-  useState,
+    createContext,
+    ReactNode,
+    useContext,
+    useEffect,
+    useState,
 } from "react";
 import { apiClient } from "../api/client";
 
@@ -17,6 +17,9 @@ type AuthContextType = AuthState & {
     email: string,
     password: string,
   ) => Promise<{ success: boolean; reason?: string }>;
+  signInWithGoogle: (
+    idToken: string,
+  ) => Promise<{ success: boolean; reason?: string }>;
   signUp: (
     email: string,
     password: string,
@@ -60,13 +63,23 @@ export function AuthProvider({ children }: { children: ReactNode }) {
     return { success: result.success, reason: result.reason };
   };
 
+  const signInWithGoogle = async (idToken: string) => {
+    const result = await apiClient.signInWithGoogle(idToken);
+    if (result.success) {
+      setState({ isLoading: false, isAuthenticated: true });
+    }
+    return { success: result.success, reason: result.reason };
+  };
+
   const signOut = async () => {
     await apiClient.signOut();
     setState({ isLoading: false, isAuthenticated: false });
   };
 
   return (
-    <AuthContext.Provider value={{ ...state, signIn, signUp, signOut }}>
+    <AuthContext.Provider
+      value={{ ...state, signIn, signInWithGoogle, signUp, signOut }}
+    >
       {children}
     </AuthContext.Provider>
   );
-- 
cgit v1.2.3

