Your IP : 216.73.216.1


Current Path : /proc/self/cwd/wp-contentn/plugins/leadin/scripts/shared/Auth/
Upload File :
Current File : //proc/self/cwd/wp-contentn/plugins/leadin/scripts/shared/Auth/useAuth.ts

import { useEffect, useState } from 'react';
import { getAuth } from '../../api/hubspotPluginApi';

export default function useAuth() {
  const [auth, setAuth] = useState(false);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    getAuth()
      .then((response: any) => {
        setAuth(!!response);
        setLoading(false);
      })
      .catch(() => setLoading(false));
  }, []);

  return { auth, loading };
}