shellphone.app/app/phone-calls/hooks/use-phone-calls.ts
2021-08-06 01:14:19 +08:00

14 lines
399 B
TypeScript

import { NotFoundError, useQuery } from "blitz";
import useCurrentPhoneNumber from "../..//core/hooks/use-current-phone-number";
import getPhoneCalls from "../queries/get-phone-calls";
export default function usePhoneCalls() {
const phoneNumber = useCurrentPhoneNumber();
if (!phoneNumber) {
throw new NotFoundError();
}
return useQuery(getPhoneCalls, { phoneNumberId: phoneNumber.id });
}