'use strict';

var hairfieApi = require('../../services/hairfie-api-client');
var PictureEvents = require('../../constants/PictureConstants').Events;

module.exports = function (context, payload, done) {
    var done = done || function () {};

    context.dispatch(PictureEvents.UPLOAD_START, {
        id: payload.id
    });

    var onProgress = function (progress) {
        context.dispatch(PictureEvents.UPLOAD_PROGRESS, {
            id      : payload.id,
            percent : progress.percent
        });
    };

    hairfieApi
        .uploadPicture(
            payload.file,
            payload.container,
            context.getAuthToken(),
            onProgress
        )
        .then(function (picture) {
            context.dispatch(PictureEvents.UPLOAD_SUCCESS, {
                id      : payload.id,
                picture : picture
            });
            done();
        })
        .fail(function (error) {
            console.log(error);
            context.dispatch(PictureEvents.UPLOAD_FAILURE, {
                id: payload.id
            });
            done(error);
        });
};

@@ -931,40 +931,8 @@
 ) %7B%0A
-            console.log(error);%0A
     

Remove log