From 877506a6484d4a566eb5551cc532ee24adf33823 Mon Sep 17 00:00:00 2001 From: Rob Whittaker Date: Thu, 8 Dec 2016 15:15:14 +0000 Subject: [PATCH] Move pieces piece-by-piece, peacefully! --- app/components/chess-board-square.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/chess-board-square.js b/app/components/chess-board-square.js index 25c254e..bb5b716 100644 --- a/app/components/chess-board-square.js +++ b/app/components/chess-board-square.js @@ -1,7 +1,7 @@ import React from "react"; import classNames from "classnames"; -import { selectPiece } from "store/actions"; +import { movePiece, selectPiece } from "store/actions"; class ChessBoardSquare extends React.Component { constructor(props) { @@ -21,6 +21,11 @@ class ChessBoardSquare extends React.Component { if (this.props.piece != undefined) { store.dispatch(selectPiece(this.squareCoords())); } + else { + console.log("About to move!"); + store.dispatch(movePiece(store.getState().selectedSquare, this.squareCoords())); + console.log("Moved!"); + } console.log(store.getState().selectedSquare); };