Files
heygermany-e2e-mrg1mo7z/apps/website/hooks/backoffice/useBackOfficeLogin.ts
e2e aae77ea31e
Some checks failed
Main / Setup and Test (push) Has been cancelled
Main / Build Website (push) Has been cancelled
chore: heygermany customer project
2026-07-11 09:28:50 +02:00

20 lines
642 B
TypeScript

import { signInWithPassword } from "@/lib/auth"
import { useMutation } from "@tanstack/react-query"
import { useParams, useRouter } from "@/framework/navigation"
export const useBackOfficeLogin = () => {
const router = useRouter()
const { lang } = useParams<{ lang?: string }>()
return useMutation({
mutationFn: async ({ email, password }: { email: string; password: string }) => {
return await signInWithPassword(email, password)
},
onSuccess: () => {
router.replace(`/${lang || 'en'}/backoffice/candidates`)
},
onError: (error) => {
console.error('BackOffice login failed:', error)
}
})
}