import { PrimariaApi } from "../../api/api";
import { BrokerDisposableHandler } from "../../api/broker/primaria-broker";
import { container } from "../../infrastructure/ioc/container";
import { registerRequest } from "../utils";
import { ExitShellHandler } from "./handler";
import { ExitShell } from "./request";

let request: BrokerDisposableHandler;

export const useExitShell = (api: PrimariaApi) => {
  disposeExitShell();
  request = registerRequest(api, container)(ExitShell, ExitShellHandler);
};

export const disposeExitShell = () => {
  request?.dispose();
};
