From 16103f2fcbffc97458a30596f1c25aab69a924cb Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Tue, 12 Apr 2022 21:24:04 -0700 Subject: [PATCH] client: temp. remove ability to view files in posts as admin --- client/components/admin/post-modal-link.tsx | 57 --------------------- server/src/routes/admin.ts | 1 + 2 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 client/components/admin/post-modal-link.tsx 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({