import { ActionTypes } from 'constants/Common';
import captchaApi from 'api/captcha';

import dispatcher from 'dispatcher';

export default {
    refresh,
};

/**
 * Обновление каптчи
 * @method  refresh
 * @returns {Promise}
 */

function refresh() {
    return captchaApi.refresh()
        .then(response => {
            dispatcher.dispatch(ActionTypes.RECEIVE_CAPTCHA, response.captcha);
        });
}
