export function useSubmitAttempt() {
  const submitAttempted = ref(false)

  function markSubmitAttempt() {
    submitAttempted.value = true
  }

  function resetSubmitAttempt() {
    submitAttempted.value = false
  }

  function hasSubmitError(isInvalid) {
    return submitAttempted.value && Boolean(isInvalid)
  }

  return {
    hasSubmitError,
    markSubmitAttempt,
    resetSubmitAttempt,
    submitAttempted,
  }
}
