import ThemeDecorator from "@enact/sandstone/ThemeDecorator";
import React, { useEffect } from "react";

import css from "./App.module.less";
import MainView from "../views/MainView/MainView";

import { useDispatch } from "react-redux";
import { fetchAuthenticationCode } from "../features/auth/authThunks";
import { fetchHomeMenu } from "../features/menu/menuThunks";

function AppBase(props) {
  const dispatch = useDispatch();

  useEffect(() => {
    dispatch(fetchAuthenticationCode());
    dispatch(fetchHomeMenu());
  }, [dispatch]);

  return <MainView />;
}

const App = ThemeDecorator({ noAutoFocus: true }, AppBase);

export default App;
export { App, AppBase };
