Logout Method Changed

This commit is contained in:
Devansh 2021-12-07 09:45:39 +05:30
parent 82e6ddef50
commit 3dbd804e23
4 changed files with 33 additions and 5 deletions

View File

@ -178,7 +178,17 @@
</li>
<li>
<a href="{{ route('customer.session.destroy') }}">{{ __('shop::app.header.logout') }}</a>
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf
@method('DELETE')
</form>
<a
href="{{ route('customer.session.destroy') }}"
onclick="event.preventDefault(); document.getElementById('customerLogout').submit();">
{{ __('shop::app.header.logout') }}
</a>
</li>
</ul>
</li>

View File

@ -78,7 +78,7 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
/**
* Logout.
*/
Route::get('logout', [SessionController::class, 'destroy'])->defaults('_config', [
Route::delete('logout', [SessionController::class, 'destroy'])->defaults('_config', [
'redirect' => 'customer.session.index'
])->name('customer.session.destroy');

View File

@ -123,10 +123,17 @@
<template v-slot:extra-navigation>
<li>
@auth('customer')
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf
@method('DELETE')
</form>
<a
class="unset"
href="{{ route('customer.session.destroy') }}">
<span>{{ __('shop::app.header.logout') }}</span>
href="{{ route('customer.session.destroy') }}"
onclick="event.preventDefault(); document.getElementById('customerLogout').submit();">
{{ __('shop::app.header.logout') }}
</a>
@endauth

View File

@ -95,7 +95,18 @@
@endif
<li>
<a href="{{ route('customer.session.destroy') }}" class="unset">{{ __('shop::app.header.logout') }}</a>
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf
@method('DELETE')
</form>
<a
class="unset"
href="{{ route('customer.session.destroy') }}"
onclick="event.preventDefault(); document.getElementById('customerLogout').submit();">
{{ __('shop::app.header.logout') }}
</a>
</li>
</ul>
</div>