Shivamyadav's avatar

Send the request to register the user and getting redirect on the post method.

I am using laravel, inertia with vue.

In my network tab I am getting this

// 302 is post method ( I can also not see any errors into the form object)
register	302	xhr / Redirect	Register.vue:51	1.2 kB	103 ms
register	200	xhr	register

my controller

My register vue component

my routes

// register routes
Route::get('/register', [AuthenticationController::class, 'register'])->name('register');
Route::post('/register', [AuthenticationController::class, 'store'])->name('register.store');
0 likes
6 replies
JussiMannisto's avatar

You get a redirect response when you send one from the back end:

return redirect()->route('login');

You also get a redirection if validation fails.

Shivamyadav's avatar

Yeah, I know it. The issue I am dealing with is not getting the validation error messages into the network tab as 422 status not even into the inertia form helper function object in the errors. It's also empty.

Might be the csrf token but then it would have returned as 419 page error.

JussiMannisto's avatar

You don't get a 422 when using Inertia. You get a redirection response like in traditional MPA apps.

Did you try logging the form object with console.log(form) to see what it holds after form submission?

It's possible that the redirection comes from some middleware before you reach the controller. Try removing the validation step to see if the dd() call is reached.

Shivamyadav's avatar

Yes, if I removed the validation I can see the dd response in the browser.

JussiMannisto's avatar

Did you do any debugging? Print out what's in the request input on the backend. Then print what's in the form object on the front end after submitting. I'm sure those tell you what's going on.

Shivamyadav's avatar
Shivamyadav
OP
Best Answer
Level 20

Find the solution it was the inertia middle Handle inertia middleware it does not have the error flash messages sharing.

Please or to participate in this conversation.