I have tried several variations of the following if statement without any luck. I'm sure it is a simple mistake.
Here is the code -
this.params = function(request) {
var queryParams;
queryParams = request.urlQuery;
var fragments = queryParams.split('&');
return {
"has_query_parameters": true,
"query_parameters": (function() {
var results;
results = [];
if ( queryParams.length != 0 ) {
for ( i in fragments ) {
var keyvalue = fragments[i].split('=')
name = keyvalue[0];
if ( i === 1 ) {
results.push( keyvalue[0] + '=" & ' + '$' + keyvalue[0] );
} else {
results.push( '&' + keyvalue[0] + '=" & ' + '$' + keyvalue[0] );
}
}
}
return results.join(" & \"");
})()
};
};
For the If statement where it says i === 1 is where the issue is. What I need to happen is have that execute if it is the first fragment. Everything I have tried so far has failed and it executes the else instead.
Here is the queryParams variable.
client_id=CLIENTIDHERE&response_type=code&scope=SCOPESHERE&redirect_uri=REDIRECTURIHERE&state=STATEHERE
Aucun commentaire:
Enregistrer un commentaire