Skip to content
Snippets Groups Projects
  • Zach Whelchel's avatar
    75186183
    SimpleFin (#2188) · 75186183
    Zach Whelchel authored
    * Some initial UI work for adding SimpleFin.
    
    * SimpleFin proof of concept working.
    
    * Adds linking & unlinking to existing accounts through the account menu UI.
    
    * Added loading and lint fixes.
    
    * Lint changes.
    
    * Added release notes.
    
    * Typecheck cleanup.
    
    * Import, lint, typecheck cleanups.
    
    * More typecheck cleanup.
    
    * Refactored language for consistency.
    
    * Added default institution name.
    
    * Lint cleanup.
    
    * Addressed change requests.
    
    * Added a default to migration, made variables consistent, added feature flag.
    
    * Added account_sync_source to server schema.
    
    * Adds account_sync_source to test.
    
    * Fix for typecheck.
    
    * Attempt to make typecheck happy.
    
    * Added strict ignore.
    
    * Moved account_sync_source to the right model (face palm).
    
    * Hotfix for institution format.
    
    * Lint cleanup.
    
    * Removed unnecessary promise.all.
    
    * Lint cleanup.
    SimpleFin (#2188)
    Zach Whelchel authored
    * Some initial UI work for adding SimpleFin.
    
    * SimpleFin proof of concept working.
    
    * Adds linking & unlinking to existing accounts through the account menu UI.
    
    * Added loading and lint fixes.
    
    * Lint changes.
    
    * Added release notes.
    
    * Typecheck cleanup.
    
    * Import, lint, typecheck cleanups.
    
    * More typecheck cleanup.
    
    * Refactored language for consistency.
    
    * Added default institution name.
    
    * Lint cleanup.
    
    * Addressed change requests.
    
    * Added a default to migration, made variables consistent, added feature flag.
    
    * Added account_sync_source to server schema.
    
    * Adds account_sync_source to test.
    
    * Fix for typecheck.
    
    * Attempt to make typecheck happy.
    
    * Added strict ignore.
    
    * Moved account_sync_source to the right model (face palm).
    
    * Hotfix for institution format.
    
    * Lint cleanup.
    
    * Removed unnecessary promise.all.
    
    * Lint cleanup.
useGoCardlessStatus.ts 755 B
import { useEffect, useState } from 'react';

import { send } from 'loot-core/src/platform/client/fetch';

import { useSyncServerStatus } from './useSyncServerStatus';

export function useGoCardlessStatus() {
  const [configuredGoCardless, setConfiguredGoCardless] = useState<
    boolean | null
  >(null);
  const [isLoading, setIsLoading] = useState(false);
  const status = useSyncServerStatus();

  useEffect(() => {
    async function fetch() {
      setIsLoading(true);

      const results = await send('gocardless-status');

      setConfiguredGoCardless(results.configured || false);
      setIsLoading(false);
    }

    if (status === 'online') {
      fetch();
    }
  }, [status]);

  return {
    configuredGoCardless,
    isLoading,
  };
}