migrate to blitzjs
This commit is contained in:
15
app/phone-calls/hooks/use-phone-calls.ts
Normal file
15
app/phone-calls/hooks/use-phone-calls.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { useQuery } from "blitz"
|
||||
|
||||
import useCurrentCustomer from "../../core/hooks/use-current-customer"
|
||||
import getPhoneCalls from "../queries/get-phone-calls"
|
||||
|
||||
export default function usePhoneCalls() {
|
||||
const { customer } = useCurrentCustomer()
|
||||
if (!customer) {
|
||||
throw new Error("customer not found")
|
||||
}
|
||||
|
||||
const { phoneCalls } = useQuery(getPhoneCalls, { customerId: customer.id })[0]
|
||||
|
||||
return phoneCalls
|
||||
}
|
Reference in New Issue
Block a user