fix: navigate back to machines page on node deletion

This commit is contained in:
Aarnav Tale 2025-03-17 10:46:31 -04:00
parent 3bdbfdc033
commit 7741ab88bf
No known key found for this signature in database

View File

@ -1,3 +1,4 @@
import { useNavigate } from 'react-router';
import Dialog from '~/components/Dialog'; import Dialog from '~/components/Dialog';
import type { Machine } from '~/types'; import type { Machine } from '~/types';
@ -8,9 +9,14 @@ interface DeleteProps {
} }
export default function Delete({ machine, isOpen, setIsOpen }: DeleteProps) { export default function Delete({ machine, isOpen, setIsOpen }: DeleteProps) {
const navigate = useNavigate();
return ( return (
<Dialog isOpen={isOpen} onOpenChange={setIsOpen}> <Dialog isOpen={isOpen} onOpenChange={setIsOpen}>
<Dialog.Panel variant="destructive"> <Dialog.Panel
variant="destructive"
onSubmit={() => navigate('/machines')}
>
<Dialog.Title>Remove {machine.givenName}</Dialog.Title> <Dialog.Title>Remove {machine.givenName}</Dialog.Title>
<Dialog.Text> <Dialog.Text>
This machine will be permanently removed from your network. To re-add This machine will be permanently removed from your network. To re-add