import { ref } from 'vue'

export function useToast() {
  const toastText = ref('')

  function toast(text) {
    toastText.value = text
    clearTimeout(toast.timer)
    toast.timer = setTimeout(() => { toastText.value = '' }, 3200)
  }

  return { toastText, toast }
}
