You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
Wondering how others in the community utilizing $inertia.form for an API request, I'll describe my use case and how I work with it at the moment.
I have a checkout page where a user submits a form (new order), the controller generates a payment link, and returns it as part of data object. Upon success, opening a modal with an iframe where the src attribute is the generated payment link. At the moment I am using axios.
Checkout.vue
axios.post('endpoint',this.form).then(({ data })=>{if(data.success){this.showLoadingBar=falsethis.order_id=data.data.order_idthis.paymentUrl=data.data.urlthis.showPaymentModal=truewindow.addEventListener('message',function(event){if(event.data.success==true){this.successPayment()}}.bind(this))}}).catch((error)=>{this.showLoadingBar=falsethis.$page.props.errors=error.response.data.errors})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
Wondering how others in the community utilizing
$inertia.form
for an API request, I'll describe my use case and how I work with it at the moment.I have a checkout page where a user submits a form (new order), the controller generates a payment link, and returns it as part of
data
object. Upon success, opening a modal with aniframe
where thesrc
attribute is the generated payment link. At the moment I am usingaxios
.Checkout.vue
ApiOrderController.php
How would you go about it using Inertia without
axios
both on the server-side and the client-side?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions