import { fetchAPI } from "./fetch"; import type { SessionUser } from "./session"; export type AuthResult = { token: string; user: SessionUser; }; // Exchanges a Google idToken (obtained via expo-auth-session on the client) // for a Waseel session issued by our own server. export const googleAuth = async ( idToken: string, ): Promise => { const response = await fetchAPI("/(api)/auth/google", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ idToken }), }); return response.data as AuthResult; };