all files / src/dashboard/ global.js

73.33% Statements 11/15
75% Branches 3/4
25% Functions 1/4
71.43% Lines 10/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                              43× 43×           43×        
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var Action = require('../actionNames');
exports.initialState = {
    isReadOnly: false
};
function setReadOnly(isReadOnly) {
    return function (dispatch) {
        dispatch(setReadOnlyAction(isReadOnly));
    };
}
exports.setReadOnly = setReadOnly;
function setReadOnlyAction(isReadOnly) {
    return {
        type: Action.SET_READONLY,
        isReadOnly: isReadOnly
    };
}
function global(state, action) {
    if (state === void 0) { state = exports.initialState; }
    switch (action.type) {
        case Action.SET_READONLY:
            return Object.assign({}, state, {
                isReadOnly: action.isReadOnly
            });
        default:
            return state;
    }
}
exports.global = global;