From 45001d581ada93661b6a1b22a81b7925b23a1194 Mon Sep 17 00:00:00 2001 From: Lewis Renfrew Date: Fri, 6 Feb 2026 13:27:13 +0000 Subject: [PATCH] fix --- .../src/components/common/SearchPanel.js | 13 +++-- src/Service.Host/client/src/index.js | 48 +++++++++++-------- .../client/src/middleware/authorization.js | 13 ++--- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/Service.Host/client/src/components/common/SearchPanel.js b/src/Service.Host/client/src/components/common/SearchPanel.js index e370a681..42df0df5 100644 --- a/src/Service.Host/client/src/components/common/SearchPanel.js +++ b/src/Service.Host/client/src/components/common/SearchPanel.js @@ -19,8 +19,12 @@ const useStyles = makeStyles(() => ({ }, paper: { backgroundColor: '#f5f5f5', - position: 'relative', - zIndex: -1 + position: 'fixed', + zIndex: 1000, + paddingTop: '80px', + width: '100%', + overflow: 'auto', + height: '100vh' }, menuItems: { fontSize: '12px', @@ -29,10 +33,9 @@ const useStyles = makeStyles(() => ({ closeButton: { marginRight: '10px', marginTop: '10px', - position: 'absolute', + float: 'right', top: 0, - right: 0, - zIndex: 1 + right: 0 }, searchInputField: { float: 'right' diff --git a/src/Service.Host/client/src/index.js b/src/Service.Host/client/src/index.js index be5e01a4..da6c8fbf 100644 --- a/src/Service.Host/client/src/index.js +++ b/src/Service.Host/client/src/index.js @@ -4,6 +4,7 @@ import { AppContainer } from 'react-hot-loader'; import { SnackbarProvider } from 'notistack'; import { linnTheme } from '@linn-it/linn-form-components-library'; import { ThemeProvider } from '@material-ui/styles'; +import { loadUser } from 'redux-oidc'; import configureStore from './configureStore'; import Root from './components/Root'; import userManager from './helpers/userManager'; @@ -14,7 +15,6 @@ const NextRoot = require('./components/Root').default; const initialState = {}; const store = configureStore(initialState); -const { user } = store.getState().oidc; const render = Component => { ReactDOM.render( @@ -29,22 +29,32 @@ const render = Component => { ); }; -if ( - (!user || user.expired) && - window.location.pathname !== '/inventory/auth/' && - window.location.pathname !== '/inventory/auth/logged-out' -) { - userManager.signinRedirect({ - data: { redirect: window.location.pathname + window.location.search } - }); -} else { - render(Root); +loadUser(store, userManager); + +userManager + .getUser() + .then(user => { + if ( + (!user || user.expired) && + window.location.pathname !== '/inventory/auth/' && + window.location.pathname !== '/inventory/auth/logged-out' + ) { + userManager.signinRedirect({ + data: { redirect: window.location.pathname + window.location.search } + }); + } else { + render(Root); - // Hot Module Replacement API - if (module.hot) { - //module.hot.accept('./reducers', () => store.replaceReducer(reducer)); - module.hot.accept('./components/Root', () => { - render(NextRoot); - }); - } -} + // Hot Module Replacement API + if (module.hot) { + //module.hot.accept('./reducers', () => store.replaceReducer(reducer)); + module.hot.accept('./components/Root', () => { + render(NextRoot); + }); + } + } + }) + .catch(error => { + console.error('Error loading user:', error); + render(Root); + }); diff --git a/src/Service.Host/client/src/middleware/authorization.js b/src/Service.Host/client/src/middleware/authorization.js index 5ea4a5bb..a066f5ed 100644 --- a/src/Service.Host/client/src/middleware/authorization.js +++ b/src/Service.Host/client/src/middleware/authorization.js @@ -1,15 +1,16 @@ import { RSAA } from 'redux-api-middleware'; import { getAccessToken } from '../selectors/getAccessToken'; -import { addressesActionTypes as actionTypes } from '../actions/index'; import { addressesActionTypes } from '../actions'; export default ({ getState }) => next => action => { - console.log(action[RSAA]?.types); - console.log(addressesActionTypes.REQUEST_SEARCH_ADDRESSES); if (action[RSAA]) { - if (action[RSAA].options - && action[RSAA].options.requiresAuth - && !action[RSAA]?.types?.some(t => t.type === addressesActionTypes.REQUEST_SEARCH_ADDRESSES)) { + if ( + action[RSAA].options && + action[RSAA].options.requiresAuth && + !action[RSAA]?.types?.some( + t => t.type === addressesActionTypes.REQUEST_SEARCH_ADDRESSES + ) + ) { // eslint-disable-next-line no-param-reassign action[RSAA].headers = { Authorization: `Bearer ${getAccessToken(getState())}`,