package idc.board.command;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import idc.model.IdcDAO;

public class BoardDeleteCmd implements BoardCmd{
	private IdcDAO dao = new IdcDAO();
	public void execute(HttpServletRequest request, HttpServletResponse response) {
		
		//checkToken 값이 다르면 true반환.
		if(dao.checkToken(request)){
			request.setAttribute("reError", dao.reError);
			return;
		}else{
			//토큰이 같아서 등록성공이 될 경우 토큰을 삭제해 준다.
			request.getSession().removeAttribute("token");
		}
				
		String inputNum = request.getParameter("num");		
		BoardDAO dao = new BoardDAO();
		dao.boardDelete(inputNum);

	}

}