Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

InertiaJS: keep current component

$
0
0

I can't wrap my head around how InertiaJS works...

I am using a vanilla PHP backend solution, so all the magic revolving around frameworks like Laravel can't help me.

I would like to submit a form (using ajax then), and get the errors... Which means I am staying on the same component if I ever have to display any error...

However, a proper InertiaJS requires a "component" prop, but for ease of use I would like to skip specifying the "component" (since it is the same...), it would make my code less redundant. But it won't work.

I also did not understand the "redirect" part of error handling that is discussed in the docs... I am returning a standard Inertia response, with a component and props, but no redirect (and it works nicely as long as I provide the component name).

How can I handle ajax errors, without having to specify a component in my response? (i.e. telling Inertia "please use the current component")

(front is using Svelte4 and the official svelte adapter, but not sure it matters)

Thank you kindly for any help,


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>