heroku deploy

This commit is contained in:
Wenszel
2021-04-30 15:14:06 +02:00
parent 79ad7c151c
commit 068cb70c0c
9 changed files with 26 additions and 22 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ function App() {
const [redirect, setRedirect] = useState();
useEffect(() => {
axios.get('http://localhost:3000/player', {
axios.get('/player', {
withCredentials:true,
})
.then(response => {
@@ -26,12 +26,12 @@ function App() {
const handleExit = e => {
e.preventDefault();
window.addEventListener('unload', () => {
axios.post('http://localhost:3000/player/exit', {withCredentials:true, })
axios.post('/player/exit', {withCredentials:true, })
});
}
const idCallback = () => {
axios.get('http://localhost:3000/player/', {
axios.get('/player/', {
withCredentials:true,
})
.then(response => {
+1 -1
View File
@@ -31,7 +31,7 @@ const Gameboard = () => {
},[pawns]);
// Fetching game data
const fetchData = useCallback(() => {
axios.get('http://localhost:3000/room/',{
axios.get('/room/',{
withCredentials:true,
}).then((response)=>{
// Filling navbar with empty player nick container
+1 -1
View File
@@ -8,7 +8,7 @@ const NameInput = ({ idCallback }) => {
}
const handleButtonClick = () => {
axios.post('http://localhost:3000/room/add',{
axios.post('/room/add',{
name: inputValue
},{
withCredentials:true,
@@ -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', {withCredentials: true}).then(response => {
axios.get('/game/roll', {withCredentials: true}).then(response => {
const utterance = new SpeechSynthesisUtterance(response.data.number);
speechSynthesis.speak(utterance);
setRolledNumber(response.data.number);
+2 -2
View File
@@ -57,7 +57,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}, {withCredentials: true, mode: 'cors'})
axios.post('/game/move', {pawnId: pawn._id}, {withCredentials: true, mode: 'cors'})
.then(() => {
setHintPawn(null);
});
@@ -180,7 +180,7 @@ const Map = ({ pawns, nowMoving, rolledNumber }) => {
paintPawn(ctx, positions[hintPawn.position].x, positions[hintPawn.position].y, hintPawn.color);
}
}
},[blinking, checkIfPawnCanMove, context.color, hintPawn, nowMoving, pawns, rolledNumber]);
},[ checkIfPawnCanMove, context.color, hintPawn, nowMoving, pawns, rolledNumber]);
// Rerender canvas when pawns have changed
useEffect(() => {
rerenderCanvas();
@@ -7,7 +7,7 @@ const ReadyButton = () => {
const [checked, setChecked] = useState(false)
const handleCheckboxChange = () => {
axios.post('http://localhost:3000/player/ready',{},{withCredentials: true});
axios.post('/player/ready',{},{withCredentials: true});
setChecked(!checked);
}