diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-04-26 18:44:48 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-26 18:45:58 +0200 |
commit | 551d839f90853b58f81d124c77442009d4df0cb4 (patch) | |
tree | ace325093a0ee9d26134ad4b3ce33a0b711e1bf8 | |
parent | 49c6a810e9a705217f4543099d8188f0f3158f6c (diff) |
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>
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/luci.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index c4f998a406..4b6894c080 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1847,6 +1847,16 @@ }, /** + * 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. * * @param {string} [key] |