export const PLAY_TILE = 'PLAY_TILE'

export function playTile(position: number) {
  return {
    type: PLAY_TILE,
    position
  }
}

import { find } from 'lodash'

export const PLAY_TILE = 'PLAY_TILE'

export function playTile(position: number) {
  return (dispatch, getState) => {
    const { board } = getState()
    const tile = find(board, { position })

    if (tile.isPlayable) {
      dispatch({
        type: PLAY_TILE,
        position
      })
    }
  }
}

Revert "Do not check if tile is playable in the action and just dispatch it"
Revert "Do not check if tile is playable in the action and just dispatch it"

This reverts commit 8927a6fafc8bd18798c1195d8a928f3d40cda8ba.
