class PublicCommentsAPIService {
    constructor(publicAPIRoute) {
        this.publicAPIRoute = publicAPIRoute;
    }

    getCommentsListFor(targetId) {
        return this.publicAPIRoute('comments').get({target: targetId}).then(
            (rv) => {
                rv = rv.plain();
                return rv.val;
            }
        );
    }
}

angular.module('materialscommons').service('publicCommentsAPI', PublicCommentsAPIService);

class PublicCommentsAPIService {
    constructor(Restangular) {
        this.Restangular = Restangular;
    }

    getCommentsListFor(datasetId) {
        return this.Restangular.one('v3').one('getCommentsForPublishedDataset').customPOST({dataset_id: datasetId}).then(
            (ds) => ds.plain().data
        );
    }
}

angular.module('materialscommons').service('publicCommentsAPI', PublicCommentsAPIService);

Switch to actionhero based API
Switch to actionhero based API
