2021-08-01 14:01:51 +00:00
|
|
|
import { useAuthenticatedSession, 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-01 14:01:51 +00:00
|
|
|
const session = useAuthenticatedSession();
|
2021-07-31 15:57:43 +00:00
|
|
|
const [customer] = useQuery(getCurrentCustomer, null);
|
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
|
|
|
}
|