mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Doc setLoggedIn & remove redundant opts
This commit is contained in:
parent
58bbb35096
commit
b9a5f7902b
1 changed files with 11 additions and 3 deletions
|
@ -20,7 +20,15 @@ import UserActivity from './UserActivity';
|
||||||
import Presence from './Presence';
|
import Presence from './Presence';
|
||||||
import dis from './dispatcher';
|
import dis from './dispatcher';
|
||||||
|
|
||||||
function setLoggedIn(credentials, options) {
|
/**
|
||||||
|
* Transitions to a logged-in state using the given credentials
|
||||||
|
* @param {string} credentials.homeserverUrl The base HS URL
|
||||||
|
* @param {string} credentials.identityServerUrl The base IS URL
|
||||||
|
* @param {string} credentials.userId The full Matrix User ID
|
||||||
|
* @param {string} credentials.accessToken The session access token
|
||||||
|
* @param {boolean} credentials.guest True if the session is a guest session
|
||||||
|
*/
|
||||||
|
function setLoggedIn(credentials) {
|
||||||
credentials.guest = Boolean(credentials.guest);
|
credentials.guest = Boolean(credentials.guest);
|
||||||
console.log("onLoggedIn => %s (guest=%s)", credentials.userId, credentials.guest);
|
console.log("onLoggedIn => %s (guest=%s)", credentials.userId, credentials.guest);
|
||||||
MatrixClientPeg.replaceUsingAccessToken(
|
MatrixClientPeg.replaceUsingAccessToken(
|
||||||
|
@ -30,7 +38,7 @@ function setLoggedIn(credentials, options) {
|
||||||
|
|
||||||
dis.dispatch({action: 'on_logged_in'});
|
dis.dispatch({action: 'on_logged_in'});
|
||||||
|
|
||||||
startMatrixClient(options);
|
startMatrixClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
@ -54,7 +62,7 @@ function logout() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startMatrixClient(options) {
|
function startMatrixClient() {
|
||||||
// dispatch this before starting the matrix client: it's used
|
// dispatch this before starting the matrix client: it's used
|
||||||
// to add listeners for the 'sync' event so otherwise we'd have
|
// to add listeners for the 'sync' event so otherwise we'd have
|
||||||
// a race condition (and we need to dispatch synchronously for this
|
// a race condition (and we need to dispatch synchronously for this
|
||||||
|
|
Loading…
Reference in a new issue