import { toastController } from "@ionic/vue";

async function toast(
    msg: string,
    options?: {
        position?: "top" | "middle" | "bottom";
        type?: "success" | "error" | "info" | "";
    }
) {
    options = options || {};
    options.position = options.position || "bottom";
    options.type = options.type || "";
    const toast = await toastController.create({
        message: msg,
        duration: 2000,
        position: options.position,
        cssClass: options.type,
    });

    await toast.present();
}

export default toast;
