Courses

Vue.js 3 + Laravel 9 SPA: CRUD with Auth

Login Form and First Authentication

Previous: Two Layouts: Authenticated and Guest
avatar
Ngozi Stephen Onyemauche

Please i have been trying to login to my dashboard and i am getting this error response "App\Http\Controllers\Auth\AuthenticatedSessionController::store(): Return value must be of type Illuminate\Http\RedirectResponse, Illuminate\Http\JsonResponse returned"

this is my AuthenticatedSessionController store method public function store(LoginRequest $request): RedirectResponse { $request->authenticate();

$request->session()->regenerate();

if ($request->wantsJson()) {
    return response()->json($request->user());
}
return redirect()->intended(RouteServiceProvider::HOME);

}

this is my web.php Route::post('login', [AuthenticatedSessionController::class, 'store']);

avatar
Ngozi Stephen Onyemauche

Yes i have found the answer, in laravel 9 AuthenticatedSessionController store method had RedirectResponse attached to it which i removed

avatar
You can use Markdown
avatar
You can use Markdown