Usually i even use this to protect the route
Route::put('/profile/{slug}','ProfilePrivateController@update')->middleware(['auth']);
Hello,
I made this middleware to protect "user settings " from being access by other auth users.
public function handle($request, Closure $next)
{
if ($request->slug != auth()->user()->slug) {
return redirect()->to('/');
}
return $next($request);
}
And I'm using vueJs to update the profile
I managed to get the slug to pass it to my url :
Route::put('/profile/{slug}','ProfilePrivateController@update');
axios.put(`/api/profile/${this.data}`)
I used props to get my slug.
so the problem is when I ever use this route it says 401 or 500 error in the console:.
am I doing this wrong?
how I can solve this problem so VUEJS can match the request URL with the auth user (Like in the middleware)?
Please or to participate in this conversation.