I have a delete modal dialog on a separate component and I wanted to hide it when successful. I’m not sure how to close but what I have in mind is to just to use redirect
inside action
but my problem it scrolls to the top. How would I do that?
Is there a better alternative?
<code>export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData();
const { _action } = Object.fromEntries(formData);
if (_action === 'is_delete') {
// some api here
throw redirect('/products')
}
return null;
}
</code>
<code>export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData();
const { _action } = Object.fromEntries(formData);
if (_action === 'is_delete') {
// some api here
throw redirect('/products')
}
return null;
}
</code>
export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData();
const { _action } = Object.fromEntries(formData);
if (_action === 'is_delete') {
// some api here
throw redirect('/products')
}
return null;
}