mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
🐕🔫
This commit is contained in:
parent
25bc337424
commit
4470e1f926
@ -122,7 +122,7 @@
|
||||
],
|
||||
"quotes": [
|
||||
2,
|
||||
"single",
|
||||
"double",
|
||||
{
|
||||
"avoidEscape": true
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ class ChessBoard extends React.Component {
|
||||
|
||||
this.channel = socket.channel("game:" + gameId, {});
|
||||
this.channel.join()
|
||||
.receive("error", resp => { console.log("Unable to join", resp) });
|
||||
.receive("error", resp => { console.log("Unable to join", resp); });
|
||||
|
||||
this.channel.on("game_update", data => {
|
||||
store.dispatch(setGame(data));
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
// To use Phoenix channels, the first step is to import Socket
|
||||
// and connect at the socket path in "lib/my_app/endpoint.ex":
|
||||
import { Socket } from "phoenix"
|
||||
import { Socket } from "phoenix";
|
||||
|
||||
let socket = new Socket("/socket", { params: { token: window.userToken } })
|
||||
let socket = new Socket("/socket", { params: { token: window.userToken } });
|
||||
|
||||
// When you connect, you'll often need to authenticate the client.
|
||||
// For example, imagine you have an authentication plug, `MyAuth`,
|
||||
@ -51,6 +51,6 @@ let socket = new Socket("/socket", { params: { token: window.userToken } })
|
||||
// Finally, pass the token on connect as below. Or remove it
|
||||
// from connect if you don't care about authentication.
|
||||
|
||||
socket.connect()
|
||||
socket.connect();
|
||||
|
||||
export default socket
|
||||
export default socket;
|
||||
|
||||
@ -6,7 +6,7 @@ const SELECT_PIECE = "SELECT_PIECE";
|
||||
export const setPlayer = (player) => {
|
||||
return {
|
||||
type: SET_PLAYER,
|
||||
player: player
|
||||
player: player,
|
||||
};
|
||||
};
|
||||
|
||||
@ -14,20 +14,20 @@ export const setGame = (data) => {
|
||||
return {
|
||||
type: SET_GAME,
|
||||
board: data.board,
|
||||
turn: data.turn
|
||||
turn: data.turn,
|
||||
};
|
||||
};
|
||||
|
||||
export const setGameId = (gameId) => {
|
||||
return {
|
||||
type: SET_GAME_ID,
|
||||
gameId: gameId
|
||||
gameId: gameId,
|
||||
};
|
||||
};
|
||||
|
||||
export const selectPiece = (coords) => {
|
||||
return {
|
||||
type: SELECT_PIECE,
|
||||
coords: coords
|
||||
coords: coords,
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user