luci-base: luci.js: add LuCI.session.getToken()

Since we're already have LuCI.session.getID() we should mirror the same
interface for retrieving the session token.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2020-04-26 18:44:48 +02:00
parent 49c6a810e9
commit 551d839f90

View file

@ -1846,6 +1846,16 @@
return env.sessionid || '00000000000000000000000000000000';
},
/**
* Retrieve the current session token.
*
* @returns {string|null}
* Returns the current session token or `null` if not logged in.
*/
getToken: function() {
return env.token || null;
},
/**
* Retrieve data from the local session storage.
*