From 0c41cbb823acb60f1deb895334846223bce95df6 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Wed, 24 May 2017 17:53:03 -0400 Subject: [PATCH] error and auth fixes --- ui/js/actions/app.js | 5 +++-- ui/js/component/app/index.js | 2 ++ ui/js/component/auth.js | 2 +- ui/js/component/errorModal/index.jsx | 4 ++-- ui/js/component/errorModal/view.jsx | 12 ++++++++---- ui/js/lbryio.js | 1 + ui/js/reducers/app.js | 4 ++-- ui/js/selectors/app.js | 4 ++-- ui/scss/component/_modal.scss | 2 +- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index d7ac439a4..0f5df575d 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -208,12 +208,13 @@ export function doCheckUpgradeAvailable() { export function doAlertError(errorList) { return function(dispatch, getState) { const state = getState() - + console.log('do alert error') + console.log(errorList) dispatch({ type: types.OPEN_MODAL, data: { modal: 'error', - error: errorList + extraContent: errorList } }) } diff --git a/ui/js/component/app/index.js b/ui/js/component/app/index.js index dcb94bd0f..5de84e28f 100644 --- a/ui/js/component/app/index.js +++ b/ui/js/component/app/index.js @@ -6,6 +6,7 @@ import { } from 'selectors/app' import { doCheckUpgradeAvailable, + doAlertError, } from 'actions/app' import { doUpdateBalance, @@ -17,6 +18,7 @@ const select = (state) => ({ }) const perform = (dispatch) => ({ + alertError: (errorList) => dispatch(doAlertError(errorList)), checkUpgradeAvailable: () => dispatch(doCheckUpgradeAvailable()), updateBalance: (balance) => dispatch(doUpdateBalance(balance)) }) diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index 9e4a6ed54..ce32f0db2 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -178,7 +178,7 @@ const ErrorStage = (props) => { return

An error was encountered that we cannot continue from.

At least we're earning the name beta.

- { this.props.errorText ?

Message: {props.errorText}

: '' } + { props.errorText ?

Message: {props.errorText}

: '' } { window.location.reload() } } />
} diff --git a/ui/js/component/errorModal/index.jsx b/ui/js/component/errorModal/index.jsx index c7db4cef4..e4e4bc24b 100644 --- a/ui/js/component/errorModal/index.jsx +++ b/ui/js/component/errorModal/index.jsx @@ -4,7 +4,7 @@ import { } from 'react-redux' import { selectCurrentModal, - selectError, + selectModalExtraContent, } from 'selectors/app' import { doCloseModal, @@ -13,7 +13,7 @@ import ErrorModal from './view' const select = (state) => ({ modal: selectCurrentModal(state), - error: selectError(state), + error: selectModalExtraContent(state), }) const perform = (dispatch) => ({ diff --git a/ui/js/component/errorModal/view.jsx b/ui/js/component/errorModal/view.jsx index 676a2d52b..c494c9cb1 100644 --- a/ui/js/component/errorModal/view.jsx +++ b/ui/js/component/errorModal/view.jsx @@ -9,10 +9,12 @@ class ErrorModal extends React.Component { const { modal, closeModal, - error, + error } = this.props - const _error_key_labels = { + const errorObj = typeof error === "string" ? { error: error } : error + + const error_key_labels = { connectionString: 'API connection string', method: 'Method', params: 'Parameters', @@ -20,13 +22,15 @@ class ErrorModal extends React.Component { message: 'Error message', data: 'Error data', } - const errorInfo = + + const errorInfoList = [] for (let key of Object.keys(error)) { let val = typeof error[key] == 'string' ? error[key] : JSON.stringify(error[key]); - let label = this._error_key_labels[key]; + let label = error_key_labels[key]; errorInfoList.push(
  • {label}: {val}
  • ); } + const errorInfo = return( { let installation_id = response.installation_id; + installation_id = installation_id.substring(0, installation_id.length) + "X" function setCurrentUser() { lbryio.call('user', 'me').then((data) => { diff --git a/ui/js/reducers/app.js b/ui/js/reducers/app.js index f80baae0b..0662d3483 100644 --- a/ui/js/reducers/app.js +++ b/ui/js/reducers/app.js @@ -70,14 +70,14 @@ reducers[types.UPDATE_VERSION] = function(state, action) { reducers[types.OPEN_MODAL] = function(state, action) { return Object.assign({}, state, { modal: action.data.modal, - extraContent: action.data.errorList + modalExtraContent: action.data.extraContent }) } reducers[types.CLOSE_MODAL] = function(state, action) { return Object.assign({}, state, { modal: undefined, - extraContent: undefined + modalExtraContent: undefined }) } diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 2563eb81b..25ed2403c 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -180,9 +180,9 @@ export const selectUpgradeDownloadItem = createSelector( (state) => state.downloadItem ) -export const selectError = createSelector( +export const selectModalExtraContent = createSelector( _selectState, - (state) => state.error + (state) => state.modalExtraContent ) export const selectDaemonReady = createSelector( diff --git a/ui/scss/component/_modal.scss b/ui/scss/component/_modal.scss index 05d5e8de1..5b637fcde 100644 --- a/ui/scss/component/_modal.scss +++ b/ui/scss/component/_modal.scss @@ -1,6 +1,6 @@ @import "../global"; -.modal-overlay { +.modal-overlay, .error-modal-overlay { position: fixed; display: flex; justify-content: center;