Skip to content

Instantly share code, notes, and snippets.

@Jarmahent
Created March 25, 2020 20:32
Show Gist options
  • Save Jarmahent/7181d40e49cd39f40362bebd50340484 to your computer and use it in GitHub Desktop.
Save Jarmahent/7181d40e49cd39f40362bebd50340484 to your computer and use it in GitHub Desktop.
if(!activeSession){
console.log("Starting new session")
// SESSION-1 SESSION WILL START HERE
this.$session.start();
var session_id = this.$session.id();
// SESSION-2 SESSION WILL CREATE PRO_TABLE
this.$session.set('pro_table', JSON.stringify([]));
this.$session.set('expected_pro_table', JSON.stringify([]));
console.log("Creating new table")
console.log(`Session-1: Session started, Session ID: ${session_id}`)
console.log(`Session-2: Session created pro_table`)
console.log(`Session-2: Session created expected_pro_table`)
}else{
// SESSION-2 SESSION WILL SET PRO_TABLE IF NO SESSION EXIST,
// IF SESSION EXIST, TAKE THE RESULTS OF FETCH ORDERS AND PUSH IT TO 'expected_pro_table'
var expected_pro_table = this.$session.get("expected_pro_table")
console.log("Pushing search results to expected pro table")
expected_pro_table.concat(res.body.search_response)
// res.body.search_response.forEach(item => expected_pro_table.push(item))
this.$session.set('expected_pro_table', expected_pro_table);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment