import { ref } from 'vue'

const toastText = ref('')

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

export function useToast() {
  return { toastText, toast }
}
