export const toAsyncAwait = (fn, defaultResult = null) => {
  return fn
    .then((res) => [true, res])
    .catch((err) => [false, defaultResult || err])
}

export const tryFormValidate = (form) => {
  return toAsyncAwait(form.value.validate())
}
