// vue3-toastify.client.ts
import Vue3Toastify, { toast, type ToastContainerOptions } from 'vue3-toastify';
import { useRouter } from '#app';
export default defineNuxtPlugin((nuxtApp) => {
const router = useRouter();
function resolveGLobalComponents(instance: App<Element>) {
instance.use(router);
}
nuxtApp.vueApp.use(
Vue3Toastify,
{
// the Toast application is separate from the main application, so we need to call .use
useHandler: resolveGLobalComponents,
// other props...
} as ToastContainerOptions,
);
return {
provide: { toast },
};
});