Fixes for subscription switching

This commit is contained in:
David Bomba 2024-01-28 11:05:50 +11:00
parent 97e7f55bc0
commit 0d9b40dcb6
3 changed files with 12 additions and 7 deletions

View File

@ -54,6 +54,6 @@ class SubscriptionPlanSwitchController extends Controller
public function not_availabe() public function not_availabe()
{ {
abort(404, 'ewwo'); abort(404, 'Not Available');
} }
} }

View File

@ -155,7 +155,6 @@ class SubscriptionPlanSwitch extends Component
$this->dispatch('redirectRoute', ['route' => $response]); $this->dispatch('redirectRoute', ['route' => $response]);
// return redirect($response);
} }
public function render() public function render()

View File

@ -42,7 +42,7 @@
@if(!$state['payment_initialised']) @if(!$state['payment_initialised'])
@foreach($this->methods as $method) @foreach($this->methods as $method)
<button <button
wire:click="handleMethodSelectingEvent('{{ $method['company_gateway_id'] }}', '{{ $method['gateway_type_id'] }}')" wire:click="handleMethodSelectingEvent('{{ $method['company_gateway_id'] }}', '{{ $method['gateway_type_id'] }}'); $wire.$refresh();"
class="px-3 py-2 border bg-white rounded mr-4 hover:border-blue-600"> class="px-3 py-2 border bg-white rounded mr-4 hover:border-blue-600">
{{ $method['label'] }} {{ $method['label'] }}
</button> </button>
@ -80,11 +80,17 @@
</div> </div>
</div> </div>
<script defer> <script>
window.addEventListener('redirectRoute', event => {
window.location.href = event.detail.route; document.addEventListener('livewire:init', () => {
Livewire.on('redirectRoute', (event) => {
window.location.href = event[0].route;
});
});
})
</script> </script>
</div> </div>