[Vuejs]-Sending an email address with axios within Vue.Js component to a laravel backend is failing

0đź‘Ť

Try using laravel’s validator instead.

One way to go about it, in your “App\Http\Controllers\Auth\RegisterController”

use Illuminate\Support\Facades\Validator; 

protected function validator(array $data)
{
    return Validator::make($data, [
        'name'              => 'required|string|max:255|unique:users',
        'email'             => 'required|string|email|unique:users',
        'password'          => 'required|string|min:6|confirmed',
    ]);
}

Make note of the unique:xxxxx rule where xxxxx is your table. https://laravel.com/docs/5.5/validation

If the email or name is not unique the validator will return the error response. So you would use it at the beginning of your register function.

public function register(Request $request)
{
    $this->validator($request->all())->validate();

    // rest of registration routine here....
}

0đź‘Ť

I think its happens because of you are using “@” symbol in url string. This is reserved character. (Which characters make a URL invalid?)
Solution: send email to verification on server in json body of post request.

Leave a comment