JSFiddle - React, Tailwind, and code Playground

by murgiaMarco

JavaScript

var realLogin = false;
var locationSearch = "?realLogin=false";

console.log("getRealLoginValue value: ", this.getRealLoginValue(locationSearch));

if(this.getRealLoginValue(locationSearch)){
	console.log("is inside, value: ", this.getRealLoginValue(locationSearch) === 'true');
} else {
	console.log("is outside");
}


    if(!realLogin && this.getRealLoginValue(locationSearch)){
         this.realLogin = this.getRealLoginValue(locationSearch) === 'true';
         console.log("fist check real login value: ", this.realLogin);
    }
    console.log("setSessionManager real login value: ", this.realLogin);




 function getRealLoginValue(locationSearch){
    if (locationSearch.match(/realLogin=([^\?|&]*)/) &&
        locationSearch.match(/realLogin=([^\?|&]*)/).length > 1){
        return locationSearch.match(/realLogin=([^\?|&]*)/)[1];
    }
    return '';
}