ultisuite-client/lib/api/hooks/use-mail-oauth.ts
2026-05-25 13:52:40 +02:00

28 lines
601 B
TypeScript

'use client'
import { useMutation } from '@tanstack/react-query'
import { apiClient } from '../client'
export interface OAuthStartPayload {
provider: 'google' | 'microsoft'
email: string
name?: string
provider_id: string
imap_host: string
imap_port: number
imap_tls: boolean
smtp_host: string
smtp_port: number
smtp_tls: boolean
}
export function useStartMailOAuth() {
return useMutation({
mutationFn: (payload: OAuthStartPayload) =>
apiClient.post<{ authorization_url: string; state: string }>(
'/mail/accounts/oauth/start',
payload
),
})
}