import { useEffect } from 'react';
import { configureIam } from '@tria-plc/iamui-common';
import { AppProviders } from './providers/AppProviders';
import { AppRouter } from './router';

const BASE_API_URL =
  (import.meta as { env?: Record<string, string> }).env?.['VITE_BASE_API_URL'] ??
  'http://localhost:3001/api';

export function App() {
  useEffect(() => {
    configureIam({ apiUrl: BASE_API_URL });
  }, []);

  return (
    <AppProviders>
      <AppRouter />
    </AppProviders>
  );
}
