chore: heygermany customer project
This commit is contained in:
20
apps/website/hooks/company/useCompanyLogin.ts
Normal file
20
apps/website/hooks/company/useCompanyLogin.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { signInWithPassword } from "@/lib/auth"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useParams, useRouter } from "@/framework/navigation"
|
||||
|
||||
export const useCompanyLogin = () => {
|
||||
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'}/company/candidates`)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error('Company login failed:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
10
apps/website/hooks/company/useGetCompanyCandidate.ts
Normal file
10
apps/website/hooks/company/useGetCompanyCandidate.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { pikku } from "@/pikku/http"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
|
||||
export const useGetCompanyCandidate = (candidateId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['company', 'candidate', candidateId],
|
||||
queryFn: async () => await pikku().get('/company/candidate/:candidateId', { candidateId }),
|
||||
enabled: !!candidateId
|
||||
})
|
||||
}
|
||||
9
apps/website/hooks/company/useGetCompanyCandidates.ts
Normal file
9
apps/website/hooks/company/useGetCompanyCandidates.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { pikku } from "@/pikku/http"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
|
||||
export const useGetCompanyCandidates = () => {
|
||||
return useQuery({
|
||||
queryKey: ['company', 'candidates'],
|
||||
queryFn: async () => await pikku().get('/company/candidate', {})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user