shellphone.app/app/core/hooks/use-current-customer.ts

14 lines
467 B
TypeScript
Raw Normal View History

2021-08-01 14:01:51 +00:00
import { useAuthenticatedSession, useQuery } from "blitz";
2021-07-31 14:33:18 +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();
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 14:33:18 +00:00
}