shellphone.app/app/phone-calls/hooks/use-phone-calls.ts

14 lines
399 B
TypeScript
Raw Normal View History

import { NotFoundError, useQuery } from "blitz";
2021-07-31 14:33:18 +00:00
2021-08-05 17:07:15 +00:00
import useCurrentPhoneNumber from "../..//core/hooks/use-current-phone-number";
import getPhoneCalls from "../queries/get-phone-calls";
2021-07-31 14:33:18 +00:00
export default function usePhoneCalls() {
2021-08-05 17:07:15 +00:00
const phoneNumber = useCurrentPhoneNumber();
if (!phoneNumber) {
throw new NotFoundError();
2021-07-31 14:33:18 +00:00
}
2021-08-05 17:07:15 +00:00
return useQuery(getPhoneCalls, { phoneNumberId: phoneNumber.id });
2021-07-31 14:33:18 +00:00
}