Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return User when Connection ready resolves #27

Open
lukeatkins opened this issue Nov 28, 2022 · 1 comment
Open

Return User when Connection ready resolves #27

lukeatkins opened this issue Nov 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@lukeatkins
Copy link

Can we please update the Connection class to return the User when the ready function resolves?
This way we can use it to logout from the device.
I don't see another way to logout with the API.
If we don't logout and try to login again, the device throws an error saying someone is already logged in.

Connection.js, line 72 onwards:

    _this.initializeCsrfTokensAndSession().then(function () {
        // Login code
        if (username) {
            // Username is specified, we need to login
            var user = new User_1.User(_this, username, password);
            user.login(true).then(function () {
                resolve(user); //Return the user that has logged in.
            }).catch(reject);
        }
        else {
            resolve();
        }
    }).catch(reject);
});
@Salamek
Copy link
Owner

Salamek commented Nov 29, 2022

PRs are welcomed

@Salamek Salamek added the enhancement New feature or request label Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants