replace early returns with NotFoundError
test /api/webhook/incoming-message
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { useQuery } from "blitz";
|
||||
import { NotFoundError, useQuery } from "blitz";
|
||||
|
||||
import useCurrentCustomer from "../../core/hooks/use-current-customer";
|
||||
import getPhoneCalls from "../queries/get-phone-calls";
|
||||
@ -6,7 +6,7 @@ import getPhoneCalls from "../queries/get-phone-calls";
|
||||
export default function usePhoneCalls() {
|
||||
const { customer } = useCurrentCustomer();
|
||||
if (!customer) {
|
||||
throw new Error("customer not found");
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const { phoneCalls } = useQuery(getPhoneCalls, { customerId: customer.id })[0];
|
||||
|
Reference in New Issue
Block a user