Hi, Have anyone success using redirect()->back()->withdata in inertia?
I am trying save my category from products.index.vue.
Here is my code :
CategoryController
public function create(Request $request)
{
// save to database
$category = $this->store($request);
// Return a JSON response indicating success
return redirect()->back()->with([
'category' => $category,
]);
}
here in my product.vue
const handleCreateCategory = (data) => {
router.post(route('category.create'),
{
//data
name: data,
}, {
onSuccess: (res) => {
console.log(res);
}
}
);
}
When i redirect back, it doesnt with 'category' props. How to solve this?