let auth = (() => {
    // user/login
    function login(username, password) {
        let userData = {
            username,
            password
        };

        return requester.post('user', 'login', 'basic', userData);
    }

    // user/register
    function register(username, password, email) {
        let userData = {
            username,
            password,
            email,
            isAdmin: '',
            basket: {},
            firstName: "",
            middleName: "",
            lastName: "",
            address: "",
            phone: ""
        };

        return requester.post('user', '', 'basic', userData);
    }

    // user/logout
    function logout() {
        let logoutData = {
            authtoken: sessionStorage.getItem('authtoken')
        };

        return requester.post('user', '_logout', 'kinvey', logoutData);
    }

    function saveSession(userInfo) {
        let id = userInfo['_id'];
        let username = userInfo['username'];
        let authtoken = userInfo._kmd.authtoken;
        let isAdmin = userInfo['isAdmin'];
        let email = userInfo['email'];
        let basket = userInfo['basket'];

        /*let firstName = userInfo['firstName'];
        let middleName = userInfo['middleName'];
        let lastName = userInfo['lastName'];
        let address = userInfo['address'];
        let phone = userInfo['phone'];*/
        let firstName = "";
        let middleName = "";
        let lastName = "";
        let address = "";
        let phone = "";

        if (userInfo['firstName'] !== undefined){
            firstName = userInfo['firstName'];
        }
        if (userInfo['middleName'] !== undefined){
            middleName = userInfo['middleName'];
        }
        if (userInfo['lastName'] !== undefined){
            lastName = userInfo['lastName'];
        }
        if (userInfo['address'] !== undefined){
            address = userInfo['address'];
        }
        if (userInfo['phone'] !== undefined){
            phone = userInfo['phone'];
        }

        sessionStorage.setItem('id', id);
        sessionStorage.setItem('username', username);
        sessionStorage.setItem('authtoken', authtoken);
        sessionStorage.setItem('isAdmin', isAdmin);
        sessionStorage.setItem('email', email);
        sessionStorage.setItem('basket', basket);
        sessionStorage.setItem('firstName', firstName);
        sessionStorage.setItem('middleName', middleName);
        sessionStorage.setItem('lastName', lastName);
        sessionStorage.setItem('address', address);
        sessionStorage.setItem('phone', phone);
    }

    function getUser(context) {
        context.id = sessionStorage.getItem('id');
        context.username = sessionStorage.getItem('username');
        context.isAdmin = sessionStorage.getItem('isAdmin') !== '';

        return sessionStorage.getItem('username');
    }

    function handleError(reason) {
        utils.showError(reason.responseJSON.description);
    }

    return {
        login,
        register,
        logout,
        saveSession,
        getUser,
        handleError
    }
})();
@@ -1203,240 +1203,8 @@
 %0D%0A%0D%0A
-        /*let firstName = userInfo%5B'firstName'%5D;%0D%0A        let middleName = userInfo%5B'middleName'%5D;%0D%0A        let lastName = userInfo%5B'lastName'%5D;%0D%0A        let address = userInfo%5B'address'%5D;%0D%0A        let phone = userInfo%5B'phone'%5D;*/%0D%0A
     

REMOVE clean up - removed unnecessary comments