components/ft-client/ft-client.js
// API endpoint that lets us get all the interactions for a given user, we will change this code.
API endpoint that lets us get all the interactions for a given user, we will change this code.
API endpoint that lets us get all the interactions for a given user we will change this code .
_getInteractionRequests()
    {
        this.interactionRequests = [];
        if (this.fakeData) {
            var version = this.interactionVersion;
            var url;
            if (version === "2.0.0")
                url = this.fakeDataPath + "fake-interaction-requests-2_0_0.json";
            else if (version === "1.0.0")
                url = this.fakeDataPath + "fake-interaction-requests-1_0_0.json";
            else
                throw new Error("Unrecognized user interaction schema version: " + version);
            return this.httpGet(url)
                .then(function (response) {
                    this.interactionRequests = response;
                    if (this._isFirstGetAllDataCall) {
                        this.challenge = null;
                        this._oldChallenges = new Set();
                        this.interactionRequests.forEach(challenge => this._oldChallenges.add(challenge.id));
                    }
                }.bind(this));
        }
        var connectionIds = this.connections.map(function (connection) { return connection.id; });
        var promises = connectionIds.map(this._getConnectionInteractionRequests.bind(this));
        return Promise.all(promises)
            .then(function (interactionRequestsPerConnection) {
                interactionRequestsPerConnection.forEach(function (interactionRequests) {
                    this.interactionRequests = this.interactionRequests.concat(interactionRequests);
                }.bind(this))
                if (this._isFirstGetAllDataCall)
                {
                    this.challenge = null;
                    this._oldChallenges = new Set();
                    this.interactionRequests.forEach(challenge => this._oldChallenges.add(challenge.id));
                }
        }.bind(this));
    }
_getInteractionRequests ( ) { this . interactionRequests = [ ] ; if ( this . fakeData ) { var version = this . interactionVersion ; var url ; if ( version === "2.0.0" ) url = this . fakeDataPath + "fake-interaction-requests-2_0_0.json" ; else if ( version === "1.0.0" ) url = this . fakeDataPath + "fake-interaction-requests-1_0_0.json" ; else throw new Error ( "Unrecognized user interaction schema version: " + version ) ; return this . httpGet ( url ) . then ( function ( response ) { this . interactionRequests = response ; if ( this . _isFirstGetAllDataCall ) { this . challenge = null ; this . _oldChallenges = new Set ( ) ; this . interactionRequests . forEach ( challenge => this . _oldChallenges . add ( challenge . id ) ) ; } } . bind ( this ) ) ; } var connectionIds = this . connections . map ( function ( connection ) { return connection . id ; } ) ; var promises = connectionIds . map ( this . _getConnectionInteractionRequests . bind ( this ) ) ; return Promise . all ( promises ) . then ( function ( interactionRequestsPerConnection ) { interactionRequestsPerConnection . forEach ( function ( interactionRequests ) { this . interactionRequests = this . interactionRequests . concat ( interactionRequests ) ; } . bind ( this ) ) if ( this . _isFirstGetAllDataCall ) { this . challenge = null ; this . _oldChallenges = new Set ( ) ; this . interactionRequests . forEach ( challenge => this . _oldChallenges . add ( challenge . id ) ) ; } } . bind ( this ) ) ; }
API endpoint that lets us get all the interactions for a given user, we will change this code.
API endpoint that lets us get all the interactions for a given user we will change this code .
// Set up current challenge properties for first call // Consolidate all connection user interaction requests // Set up current challenge properties for first call