Skip to content

Commit

Permalink
Merge c01ed12 into a08226a
Browse files Browse the repository at this point in the history
  • Loading branch information
jsveron23 committed Mar 4, 2019
2 parents a08226a + c01ed12 commit 5f74940
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/actions/ingame.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ export function setSnapshot (snapshot) {

export function setNext (snapshot) {
return (dispatch, getState) => {
return Promise.all([setSnapshot(snapshot), setMovableAxis(), toggleTurn()])
.then(map(dispatch))
.then(() => {
const { ingame } = getState()
const { present, past } = ingame
const { turn } = present

const checkBy = findCheckCode(() => {
const { side, piece, file, rank } = compose(
diffSnapshot(snapshot),
getPrevSnapshot
)(past)

return { turn, snapshot, side, piece, file, rank }
})

return Promise.all([setCheckBy(checkBy), setSelected()])
})
.then(map(dispatch))
dispatch(setSnapshot(snapshot))
dispatch(setMovableAxis())
dispatch(toggleTurn())
dispatch(setSelected())

const { ingame } = getState()
const { present, past } = ingame
const { turn } = present

const checkBy = findCheckCode(() => {
const { side, piece, file, rank } = compose(
diffSnapshot(snapshot),
getPrevSnapshot
)(past)

return { turn, snapshot, side, piece, file, rank }
})

dispatch(setCheckBy(checkBy))
}
}

Expand Down

0 comments on commit 5f74940

Please sign in to comment.