LuCI. session

The session class provides various session related functionality.

Methods

getID() → {string}

Retrieve the current session ID.

Returns:

Returns the current session ID.

Type: 
string

getLocalData(keyopt) → {*}

Retrieve data from the local session storage.

Parameters:
NameTypeAttributesDescription
keystring<optional>

The key to retrieve from the session data store. If omitted, all session data will be returned.

Returns:

Returns the stored session data or null if the given key wasn't found.

Type: 
*

getToken() → {string|null}

Retrieve the current session token.

Returns:

Returns the current session token or null if not logged in.

Type: 
string | null

setLocalData(key, value) → {boolean}

Set data in the local session storage.

Parameters:
NameTypeDescription
keystring

The key to set in the session data store.

value*

The value to store. It will be internally converted to JSON before being put in the session store.

Returns:

Returns true if the data could be stored or false on error.

Type: 
boolean