import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { useZino } from '../api/provider.jsx' import { ORG_ID } from '../api/config.js' import logo from '../assets/brand/zurich_logo.webp' import './Login.css' const FEATURES = [ { title: 'Instant policy issuance', body: 'No inspection; hassle free policy', icon: ( <> ), }, { title: '24/7 claim assistance', body: 'Making claims simple, transparent, and customer-first', icon: ( <> ), }, { title: 'A trusted brand', body: 'You can count on Zurich Kotak General Insurance at all times', icon: ( <> ), }, ] export default function Login() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [submitting, setSubmitting] = useState(false) const { signIn } = useZino() const navigate = useNavigate() async function handleSubmit(event) { event.preventDefault() setError('') if (!email.trim() || !password) { setError('Enter your email and password to continue.') return } setSubmitting(true) try { // org_id must be a STRING — the gateway rejects a number with // "cannot unmarshal number into Go struct field LoginRequest.org_id". await signIn(email.trim(), password, ORG_ID) navigate('/', { replace: true }) } catch (err) { // Surface what the gateway actually said. "Invalid credentials" would // hide the two failures that look identical from here and are not: // a wrong password, and a user with no access to this app. setError(err?.message || 'We could not sign you in. Please try again.') } finally { setSubmitting(false) } } return (
Zurich Kotak General Insurance

Sign in

Enter your credentials to access your dashboard.

{error ? (

{error}

) : null}

Powered by zino

) }