Permit to dissociate data by room

- Update share room id.
 - Join room when a scene is loaded.
 - Add a room in constant variable.
This commit is contained in:
gparant 2020-05-10 13:58:32 +02:00
parent 27c6034661
commit 5f11b065e1
7 changed files with 46 additions and 27 deletions

View file

@ -1,7 +1,7 @@
import {Application, Request, Response} from "express";
import Jwt from "jsonwebtoken";
import {BAD_REQUEST, OK} from "http-status-codes";
import {SECRET_KEY, ROOM} from "../Enum/EnvironmentVariable"; //TODO fix import by "_Enum/..."
import {SECRET_KEY, ROOM_STARTED, URL_ROOM_STARTED} from "../Enum/EnvironmentVariable"; //TODO fix import by "_Enum/..."
import { uuid } from 'uuidv4';
export class AuthenticateController{
@ -23,15 +23,11 @@ export class AuthenticateController{
}
//TODO check user email for The Coding Machine game
let userId = uuid();
let token = Jwt.sign({email: param.email, roomId: ROOM, userId: userId}, SECRET_KEY, {expiresIn: '24h'});
let token = Jwt.sign({email: param.email, userId: userId}, SECRET_KEY, {expiresIn: '24h'});
return res.status(OK).send({
token: token,
roomId: ROOM,
startedRoom: {key: ROOM_STARTED, url: URL_ROOM_STARTED},
userId: userId,
maps: [
"floor0",
"floor1"
]
});
});
}