import React from 'react';
import { useParams } from 'react-router-dom';
import * as Store from './dashboard-store';
import { Dashboard } from './dashboard';

export const DashboardPage = (): JSX.Element => {
  const params = useParams();
  const id = params.id as string;

  const store = Store.Dashboard.create({
    id: id,
    loaded: false,
  });
  Store.DashboardLoadData(store).then(() => {
    return Store.LoadDataForWidgets(store);
  });

  return <Dashboard store={store} />;
};
