summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-26 18:44:48 +0200
committerJo-Philipp Wich <jo@mein.io>2020-04-26 18:45:58 +0200
commit551d839f90853b58f81d124c77442009d4df0cb4 (patch)
treeace325093a0ee9d26134ad4b3ce33a0b711e1bf8 /modules/luci-base/htdocs
parent49c6a810e9a705217f4543099d8188f0f3158f6c (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>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js10
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 c4f998a40..4b6894c08 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]