don't throw if permissions addon isn't loaded PR: #822 PR-URL: https://github.com/apache/couchdb-fauxton/pull/822 Reviewed-By: garren smith <garren.sm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a8292a4c Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a8292a4c Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a8292a4c Branch: refs/heads/master Commit: a8292a4cdc72f2f735fa85ab3b50f3a361e16d2f Parents: 25630f4 Author: Robert Kowalski <robertkowal...@apache.org> Authored: Wed Dec 14 15:15:06 2016 +0100 Committer: Robert Kowalski <robertkowal...@apache.org> Committed: Wed Dec 14 15:43:18 2016 +0100 ---------------------------------------------------------------------- app/main.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a8292a4c/app/main.js ---------------------------------------------------------------------- diff --git a/app/main.js b/app/main.js index 7f092da..5cf474a 100644 --- a/app/main.js +++ b/app/main.js @@ -57,11 +57,19 @@ $(document).on("click", "a:not([data-bypass])", function (evt) { } }); +function getReducers (r) { -const reducer = FauxtonAPI.reducers.reduce((el, acc) => { - acc[el] = el; - return acc; -}, {}); + if (!r.length) { + return function () {}; + } + + return FauxtonAPI.reducers.reduce((el, acc) => { + acc[el] = el; + return acc; + }, {}); +} + +const reducer = getReducers(FauxtonAPI.reducers); const middlewares = [thunk];