feat: Aggiunto logout

This commit is contained in:
Maicol Battistini 2021-12-14 12:34:17 +01:00
parent ac629b928d
commit d8a77e47f1
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
4 changed files with 12 additions and 13 deletions

View File

@ -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;

6
resources/js/app.js vendored
View File

@ -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');
});

View File

@ -27,11 +27,8 @@
</mwc-button>
</a>
<br>
<form action="" method="post">
@csrf
<mwc-button outlined type="submit" label="@lang('Esci')" style="margin-top: 16px;">
<mwc-button id="logout-button" outlined label="@lang('Esci')" style="margin-top: 16px;">
<i class="mdi mdi-logout-variant" slot="icon"></i>
</mwc-button>
</form>
<hr>
</mwc-menu>

View File

@ -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.')