import { isEmail, isValidPhone } from "./validate"

export function elIsEmail(rule, value, callback) {
    console.log('value',value);
    if (!value) {
        return callback(new Error('Please enter your email'))
    }
    if (!isEmail(value)) {
        return callback(new Error('Please enter a valid email address'))
    }
    callback()
}

export function elIsValidatePhone(rule, value, callback) {
    if (!value) {
        return callback(new Error('Please enter your phone number'))
    }
    if (!isValidPhone(value)) {
        return callback(new Error('Please enter a valid phone number'))
    }
    callback()
}