import { PropsWithChildren } from "react";
import { AsyncWidget } from "./AsyncWidget";
import { ServerApi } from "../api/ServerApi";

export function LoadServerConfig(p: PropsWithChildren): React.ReactElement {
  const load = async () => {
    await ServerApi.LoadConfig();
  };

  return (
    <AsyncWidget
      loadKey={0}
      errMsg="Failed to load server config!"
      load={load}
      build={() => <>{p.children}</>}
    />
  );
}