add > for gamesession and sessionnbr
This commit is contained in:
parent
44183cd1b5
commit
86ceafae40
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/06/17 01:00:00 by apommier #+# #+# */
|
||||
/* Updated: 2023/06/28 13:57:06 by apommier ### ########.fr */
|
||||
/* Updated: 2023/06/28 16:50:11 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -54,9 +54,7 @@ export class AppController {
|
||||
if(!user)
|
||||
return ;
|
||||
if (user.sessionNumber === 1)
|
||||
{
|
||||
user.status = 0;
|
||||
}
|
||||
user.sessionNumber--;
|
||||
this.userService.save(user);
|
||||
}
|
||||
@ -210,6 +208,7 @@ export class AppController {
|
||||
@Post('/rmGame')
|
||||
async removeGame(@Request() req, @Body() data: any) {
|
||||
const user = await this.userService.findOne(req.user.username);
|
||||
if (user.gameSession > 0)
|
||||
user.gameSession -= 1;
|
||||
if (user.gameSession === 0)
|
||||
user.status = 1;
|
||||
@ -303,6 +302,7 @@ export class AppController {
|
||||
const user = await this.userService.findOne(req.user.username);
|
||||
if (!user)
|
||||
return ;
|
||||
if (user.sessionNumber > 0)
|
||||
user.sessionNumber--;
|
||||
console.log("seesion number=", user.sessionNumber)
|
||||
if (!user.sessionNumber)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
REACT_APP_BASE_URL=paul-f4Ar4s3:8080
|
||||
REACT_APP_SOCKET_URL=paul-f4Ar4s3
|
||||
REACT_APP_BASE_URL=paul-f5Ar4s4:8080
|
||||
REACT_APP_SOCKET_URL=paul-f5Ar4s4
|
||||
|
||||
REACT_APP_API_SECRET=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
|
||||
REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789
|
||||
@ -8,7 +8,7 @@ REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d
|
||||
|
||||
# REACT_APP_BASE_URL=92.143.191.152
|
||||
# REACT_APP_BASE_URL=192.168.1.19
|
||||
REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fpaul-f4Ar4s3%3A8080%2Fapi%2Fauth%2Flogin&response_type=code"
|
||||
REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fpaul-f5Ar4s4%3A8080%2Fapi%2Fauth%2Flogin&response_type=code"
|
||||
|
||||
# REACT_APP_BASE_URL=92.143.191.152
|
||||
# REACT_APP_BASE_URL=192.168.1.19
|
||||
|
||||
@ -48,11 +48,13 @@ function AnimatedRoute() {
|
||||
handleLoad();
|
||||
|
||||
window.addEventListener("beforeunload", async (event) => {
|
||||
if (!localStorage.getItem('token'))
|
||||
return;
|
||||
await api.post("/quit");
|
||||
});
|
||||
window.addEventListener("unload", async (event) => {
|
||||
await api.post("/quit");
|
||||
});
|
||||
// window.addEventListener("unload", async (event) => {
|
||||
// await api.post("/quit");
|
||||
// });
|
||||
|
||||
|
||||
return () => {
|
||||
|
||||
@ -86,7 +86,6 @@ const Modal = ({handleClose}: ModalProps) => {
|
||||
const ret = await api.post("/verifyPassword", {convId: channel, password: PassWord})
|
||||
if (ret)
|
||||
console.log("ici ret password", ret);
|
||||
|
||||
// window.location.reload();
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@ -115,7 +114,7 @@ const Modal = ({handleClose}: ModalProps) => {
|
||||
console.log("ici test channel= ", channel)
|
||||
|
||||
await api.post("/join", {convId: channel})
|
||||
window.location.reload();
|
||||
// window.location.reload();
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ services:
|
||||
- 5432:5432
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
- ./conf/init.sql:/docker-entrypoint-initdb.d/create_tables.sql
|
||||
# - ./conf/init.sql:/docker-entrypoint-initdb.d/create_tables.sql
|
||||
networks:
|
||||
- pongNetwork
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user