- 찜리스트 들어가기위한 인증토큰 빽으로 헤더에 담아 넘기기
찜리스트 인증인가로 보여주기
componentDidMount() {
fetch('http://10.58.0.59:8000/user/wishlist', {
// method: 'GET',
headers: {
Authorization:sessionStorage.getItem("token")
},
})
.then(res => res.json())
.then(res => {
console.log('페치', res.result);
this.setState({
wishlistItems: res.result,
});
});
장바구니 텅텅 비우거라
deleteAllHandler = () => {
fetch(`${API}/cart`, {
method: "DELETE",
headers: {
Authorization: localStorage.getItem("token"),
},
}).then((res) => {
this.setState({ carts: [] });
});
};