import { createApp } from "vue";
import Toast from "./toast.vue";

export default function useToast() {
  function showMessage(obj) {
    const messageInstance = createApp(Toast);
    const mountNode = document.createElement("div");
    document.body.appendChild(mountNode);
    const vm = messageInstance.mount(mountNode);
    vm.showMessage(obj);
  }
  return { showMessage };
}
