feat: ✨ Aggiunto logout
This commit is contained in:
parent
ac629b928d
commit
d8a77e47f1
|
@ -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;
|
||||
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -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;">
|
||||
<i class="mdi mdi-logout-variant" slot="icon"></i>
|
||||
</mwc-button>
|
||||
</form>
|
||||
<mwc-button id="logout-button" outlined label="@lang('Esci')" style="margin-top: 16px;">
|
||||
<i class="mdi mdi-logout-variant" slot="icon"></i>
|
||||
</mwc-button>
|
||||
<hr>
|
||||
</mwc-menu>
|
||||
|
|
|
@ -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.')
|
||||
|
|
Loading…
Reference in New Issue