/*
 * @FilePath     : /src/utils/validateForm.js
 * @Description  :
 */
//多表单校验
export const validateForms = async formRefs => {
  let objectList = []
  let results = formRefs.map(
    formRef =>
      new Promise((resolve, reject) => {
        formRef.validate((valid, object) => {
          if (valid) {
            resolve()
          } else {
            objectList.push(object)
            reject()
          }
        })
      }),
  )
  try {
    return await Promise.all(results)
  } catch {
    return await Promise.reject(objectList)
  }
}
