mirror of
https://gitlab.com/MisterBiggs/hello-remix.git
synced 2025-08-09 07:01:32 +00:00
I got bored and just started reading but fun tut
This commit is contained in:
13
app/routes/contacts.$contactId_.destroy.tsx
Normal file
13
app/routes/contacts.$contactId_.destroy.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/node";
|
||||
import { redirect } from "@remix-run/node";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
import { deleteContact } from "../data";
|
||||
|
||||
export const action = async ({
|
||||
params,
|
||||
}: ActionFunctionArgs) => {
|
||||
invariant(params.contactId, "Missing contactId param");
|
||||
await deleteContact(params.contactId);
|
||||
return redirect("/");
|
||||
};
|
Reference in New Issue
Block a user