moved moving from client to server
This commit is contained in:
@@ -11,7 +11,7 @@ const Dice = ({ rolledNumberCallback, nowMoving }) => {
|
||||
const [rolledNumber, setRolledNumber] = useState();
|
||||
const [images] = useState([one, two, three, four, five, six]);
|
||||
const handleRoll = () => {
|
||||
axios.get('http://localhost:3000/game/roll').then(response => {
|
||||
axios.get('http://localhost:3000/game/roll', {withCredentials: true}).then(response => {
|
||||
const utterance = new SpeechSynthesisUtterance(response.data.number);
|
||||
speechSynthesis.speak(utterance);
|
||||
setRolledNumber(response.data.number);
|
||||
|
||||
@@ -55,7 +55,7 @@ const Map = ({ pawns, nowMoving, rolledNumber }) => {
|
||||
y = event.clientY - rect.top;
|
||||
for(const pawn of pawns){
|
||||
if (ctx.isPointInPath(pawn.circle, x, y)) {
|
||||
axios.post('http://localhost:3000/game/move', {pawnId: pawn._id, position: hintPawn.position}, {withCredentials: true})
|
||||
axios.post('http://localhost:3000/game/move', {pawnId: pawn._id}, {withCredentials: true, mode: 'cors'})
|
||||
.then(() => {
|
||||
setHintPawn(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user