multi tenancy stuff
This commit is contained in:
@ -1,15 +1,13 @@
|
||||
import { NotFoundError, useQuery } from "blitz";
|
||||
|
||||
import useCurrentCustomer from "../../core/hooks/use-current-customer";
|
||||
import useCurrentPhoneNumber from "../..//core/hooks/use-current-phone-number";
|
||||
import getPhoneCalls from "../queries/get-phone-calls";
|
||||
|
||||
export default function usePhoneCalls() {
|
||||
const { customer } = useCurrentCustomer();
|
||||
if (!customer) {
|
||||
const phoneNumber = useCurrentPhoneNumber();
|
||||
if (!phoneNumber) {
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const { phoneCalls } = useQuery(getPhoneCalls, { customerId: customer.id })[0];
|
||||
|
||||
return phoneCalls;
|
||||
return useQuery(getPhoneCalls, { phoneNumberId: phoneNumber.id });
|
||||
}
|
||||
|
Reference in New Issue
Block a user