'use server'; import { signInWithApple } from '@/lib/queries'; import { SubmitButton, type SubmitButtonProps, } from '@/components/default/forms'; import { SupabaseServer } from '@/utils/supabase'; import { FaApple } from 'react-icons/fa'; import { type ComponentProps } from 'react'; import { cn } from '@/lib/utils'; export type SignInWithAppleProps = { submitButtonProps?: SubmitButtonProps; formClassName?: ComponentProps<'form'>['className']; formProps?: Omit, 'className'>; textClassName?: ComponentProps<'p'>['className']; textProps?: Omit, 'className'>; iconClassName?: ComponentProps<'svg'>['className']; iconProps?: Omit, 'className'>; }; export const SignInWithApple = async ({ submitButtonProps, formClassName, formProps, textClassName, textProps, iconClassName, iconProps, } : SignInWithAppleProps) => { const supabase = await SupabaseServer(); const handleSignInWithApple = async () => { try { if (!supabase) throw new Error('Supabase client not found'); const result = await signInWithApple(supabase); if (result.error) throw new Error(`Error signing in with Microsoft: ${result.error.message}`); else if (result.data.url) window.location.href = result.data.url; } catch (error) { console.error(error); } }; return (

Sign In with Apple

); };