import React, { MouseEvent } from "react"; import { useLocation, useNavigate, Link, Outlet } from "react-router-dom"; import { postApi } from "../apis"; import { PostType } from "../types"; export interface PostState { state: PostType; } export function IntoPost() { const location = useLocation() as PostState; const post = location.state; const navigate = useNavigate(); // console.log(post); const handleDeleteClick = async (event: MouseEvent) => { const postId = event.currentTarget.id; const res = await postApi.deletePost(postId); navigate("/board", { replace: true }); console.log("delete post", res); }; return (
제목: {post.title}
작성자: {post.user}
도시: {post.city}
테마: {post.theme}
작성일: {post.date}
조회수: {post.counts}
files
{post.text}
); }