Sha256: 9edc6189de8449724ca7e504e89bc9e7a43fc0cee5166d3f3404bd2e5682d683

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

import {createStore} from 'fluxxor';
import _ from 'lodash';
import constants from '../constants';

export default createStore({
    initialize() {
        this.flashMsgs = [];

        this.bindActions(
            constants.FLASH_MESSAGE, this.onFlashMessage,
            constants.FLASH_MESSAGE_CLEAR, this.onFlashMessageClear
        );
    },

    onFlashMessage(payload) {
        this.flashMsgs.push({
            msg: payload.msg,
            status: payload.status
        });

        this.emit('change');
    },

    onFlashMessageClear() {
        this.flashMsgs = [];

        this.emit('change');
    },

    getState() {
        return {
            flashMsgs: _.clone(this.flashMsgs, true)
        };
    }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-1.6.0 app/src/stores/app_store.js