diff --git a/react-springboot/book/book-frontend/src/pages/book/Detail.js b/react-springboot/book/book-frontend/src/pages/book/Detail.js index fa3d5d17..a17e9df8 100644 --- a/react-springboot/book/book-frontend/src/pages/book/Detail.js +++ b/react-springboot/book/book-frontend/src/pages/book/Detail.js @@ -1,4 +1,5 @@ import React, { useEffect, useState } from 'react'; +import { Button } from 'react-bootstrap'; const Detail = (props) => { const id = props.match.params.id; @@ -15,11 +16,25 @@ const Detail = (props) => { .then((res) => { setBook(res); }); - }, []); + }, [id]); + + const deleteBook = () => { + fetch('http://localhost:8080/book/' + id, { + method: 'delete', + }) + .then((res) => res.text()) + .then((res) => { + res === 'ok' ? props.history.push('/') : alert('삭제실패'); + }); + }; return (

책 상세보기

+ {' '} +

{book.author}

{book.title}