Skip to content

Commit

Permalink
Merge pull request #896 from laravel/redirect-payment-with-status
Browse files Browse the repository at this point in the history
[10.x] Redirect with status
  • Loading branch information
taylorotwell authored Mar 24, 2020
2 parents 7f38371 + 39ccbb8 commit b85aa85
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions resources/views/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class="inline-block w-full px-4 py-3 mb-4 text-white rounded-lg hover:bg-blue-50
</div>
@endif

<a href="{{ $redirect ?? url('/') }}"
<button @click="goBack" ref="goBackButton" data-redirect="{{ $redirect ?? url('/') }}"
class="inline-block w-full px-4 py-3 bg-gray-200 hover:bg-gray-300 text-center text-gray-700 rounded-lg">
{{ __('Go back') }}
</a>
</button>
</div>

<p class="text-center text-gray-500 text-sm">
Expand Down Expand Up @@ -149,6 +149,19 @@ class="inline-block w-full px-4 py-3 bg-gray-200 hover:bg-gray-300 text-center t
}
});
},
goBack: function () {
var self = this;
var button = this.$refs.goBackButton;
var redirect = new URL(button.dataset.redirect);
if (self.successMessage || self.errorMessage) {
redirect.searchParams.append('message', self.successMessage ? self.successMessage : self.errorMessage);
redirect.searchParams.append('success', !! self.successMessage);
}
window.location.href = redirect;
},
},
})
</script>
Expand Down

0 comments on commit b85aa85

Please sign in to comment.