game name from get parameter

This commit is contained in:
Suvodip
2024-10-18 16:59:03 +05:30
parent 9ebf6f5d60
commit ff80faaf7d
7 changed files with 175 additions and 161 deletions

View File

@@ -5,6 +5,7 @@ function retryGame(){
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const userId = urlParams.get('userId');
const gameVersion = urlParams.get('gameName');
let gameId;
let submitNotic;
@@ -15,28 +16,28 @@ let startTime = Date.now();
const url = window.location.href;
const gameName = url.split('/');
const gameType = gameName[3].split('?id=');
let gameVersion;
// let gameVersion;
// console.log("Here is game name ", gameType[0])
if(gameType[0] == "guided-tracing"){
gameVersion = gameType[0].split('?')[0];
gameId = gameName[4];
console.log('Type - 1');
// if(gameType[0] == "guided-tracing"){
// gameVersion = gameType[0].split('?')[0];
// gameId = gameName[4];
// console.log('Type - 1');
} else if(gameName.length == 4){
gameVersion = gameName[3].split('?')[0];
gameId = urlParams.get('id');
}
else if(gameName.length == 5){
gameVersion = gameName[3] + '-' + gameName[4].split('?')[0];
gameId = urlParams.get('id');
console.log('Type - 2');
}else if(gameName.length == 6){
gameVersion = gameType[0] + '-' + gameName[4];
gameId = urlParams.get('id');
console.log('Type - 3');
}
// } else if(gameName.length == 4){
// gameVersion = gameName[3].split('?')[0];
// gameId = urlParams.get('id');
// }
// else if(gameName.length == 5){
// gameVersion = gameName[3] + '-' + gameName[4].split('?')[0];
// gameId = urlParams.get('id');
// console.log('Type - 2');
// }else if(gameName.length == 6){
// gameVersion = gameType[0] + '-' + gameName[4];
// gameId = urlParams.get('id');
// console.log('Type - 3');
// }
console.log(gameVersion)