2021-08-03 18:46:47 +00:00
|
|
|
import { useSession, useQuery } from "blitz";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-07-31 15:57:43 +00:00
|
|
|
import getCurrentCustomer from "../../customers/queries/get-current-customer";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
|
|
|
export default function useCurrentCustomer() {
|
2021-08-03 18:46:47 +00:00
|
|
|
const session = useSession();
|
|
|
|
const [customer] = useQuery(getCurrentCustomer, null, { enabled: Boolean(session.userId) });
|
2021-07-31 14:33:18 +00:00
|
|
|
return {
|
|
|
|
customer,
|
2021-08-01 14:01:51 +00:00
|
|
|
hasFilledTwilioCredentials: Boolean(customer && customer.accountSid && customer.authToken),
|
|
|
|
hasCompletedOnboarding: session.hasCompletedOnboarding,
|
2021-07-31 15:57:43 +00:00
|
|
|
};
|
2021-07-31 14:33:18 +00:00
|
|
|
}
|