superdesk/superdesk-client-core

View on GitHub
scripts/core/upload/upload-service.ts

Summary

Maintainability
A
0 mins
Test Coverage
angular.module('superdesk.core.upload.upload', []).service('upload', ['Upload', function(Upload) {
    /**
     * Start upload
     *
     * @param {Object} config
     * @returns Promise
     */
    this.start = function(config) {
        config.isUpload = true;
        return Upload.upload(config);
    };

    /**
     * Restart upload
     *
     * @param {Object} config
     * @returns {Promise}
     */
    this.restart = function(config) {
        return Upload.http(config);
    };

    /**
     * Test if given request config is an upload
     *
     * @param {Object} config
     * @returns {bool}
     */
    this.isUpload = function(config) {
        return config.isUpload || false;
    };
}]);