diff --git a/client/components/admin/post-modal-link.tsx b/client/components/admin/post-modal-link.tsx deleted file mode 100644 index 4a8fcbbe..00000000 --- a/client/components/admin/post-modal-link.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { Link, Modal, useModal } from "@geist-ui/core" -import { Post } from "@lib/types" -import Cookies from "js-cookie" -import useSWR from "swr" -import { adminFetcher } from "." -import styles from "./admin.module.css" - -const PostModal = ({ id }: { id: string }) => { - const { visible, setVisible, bindings } = useModal() - const { data: post, error } = useSWR( - `/server-api/admin/post/${id}`, - adminFetcher - ) - if (error) return failed to load - if (!post) return loading... - - const deletePost = async () => { - await fetch(`/server-api/admin/post/${id}`, { - method: "DELETE", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${Cookies.get("drift-token")}` - } - }) - setVisible(false) - } - - return ( - <> - setVisible(true)}> - {post.title} - - - {post.title} - Click an item to expand - {post.files?.map((file) => ( -
- -
- {file.title} -
-
-
-
- ))} - - Delete - - setVisible(false)}> - Close - -
- - ) -} - -export default PostModal diff --git a/server/src/routes/admin.ts b/server/src/routes/admin.ts index 89716be4..457247de 100644 --- a/server/src/routes/admin.ts +++ b/server/src/routes/admin.ts @@ -83,6 +83,7 @@ admin.delete("/users/:id", async (req, res, next) => { error: "User not found" }) } + // TODO: verify CASCADE is removing files + posts await user.destroy() res.json({