diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 4d9fbab15..f223dad99 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -2,14 +2,9 @@ namespace App\Http\Controllers; -use App\Models\User; -use Illuminate\Auth\Events\PasswordReset; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Illuminate\Support\Facades\Hash; -use Illuminate\Support\Facades\Password; -use Illuminate\Support\Str; use Illuminate\Validation\ValidationException; use JetBrains\PhpStorm\ArrayShape; diff --git a/resources/js/app.js b/resources/js/app.js index 95a0d7413..8cf5ad355 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -9,6 +9,7 @@ import { } from 'async-wait-until'; import $ from 'cash-dom'; import m from 'mithril'; +import redaxios from 'redaxios'; import {__} from './utils'; @@ -45,3 +46,8 @@ createInertiaApp({ import('./_material'); } }); + +$('#logout-button').on('click', async () => { + await redaxios.post(window.route('auth.logout')); + window.location.href = window.route('auth.login'); +}); diff --git a/resources/views/layouts/top-app-bar-menus.blade.php b/resources/views/layouts/top-app-bar-menus.blade.php index d01dd3f3a..19dc20218 100644 --- a/resources/views/layouts/top-app-bar-menus.blade.php +++ b/resources/views/layouts/top-app-bar-menus.blade.php @@ -27,11 +27,8 @@
-
- @csrf - - - -
+ + +
diff --git a/routes/web.php b/routes/web.php index f54349e51..6cba550eb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -39,11 +39,12 @@ Route::name('auth.') ->group(static function () { Route::inertia('login', 'LoginPage') ->name('login'); + Route::post('login', [AuthController::class, 'authenticate']) ->name('authenticate'); - /*Route::post('logout', 'Auth\LoginController@logout') - ->name('auth.logout');*/ + Route::post('logout', [AuthController::class, 'logout']) + ->name('logout'); }); Route::name('password.')