UNPKG

opds-web-client

Version:
42 lines (41 loc) 1.21 kB
"use strict"; ; var initialState = { showForm: false, callback: null, cancel: null, credentials: null, title: null, error: null, providers: null }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (state, action) { if (state === void 0) { state = initialState; } switch (action.type) { case "SHOW_AUTH_FORM": return Object.assign({}, state, { showForm: true, callback: action.callback, cancel: action.cancel, title: action.error ? state.title : action.title, error: action.error || null, providers: action.providers }); case "HIDE_AUTH_FORM": return Object.assign({}, state, { showForm: false, error: null }); case "SAVE_AUTH_CREDENTIALS": return Object.assign({}, state, { credentials: action.credentials }); case "CLEAR_AUTH_CREDENTIALS": return Object.assign({}, state, { credentials: null }); default: return state; } };