diff --git a/ui/src/App.js b/ui/src/App.js index d6d0249a9..370870d60 100644 --- a/ui/src/App.js +++ b/ui/src/App.js @@ -26,70 +26,54 @@ const i18nProvider = polyglotI18nProvider( const history = createHashHistory() -const App = () => { - try { - const appConfig = JSON.parse(window.__APP_CONFIG__) - - // This flags to the login process that it should create the first account instead - if (appConfig.firstTime) { - localStorage.setItem('initialAccountCreation', 'true') - } - localStorage.setItem('baseURL', appConfig.baseURL) - } catch (e) {} - - return ( - ( + + - - {(permissions) => [ + {(permissions) => [ + , + , + , + , + permissions === 'admin' ? ( + + ) : null, + , + permissions === 'admin' ? ( , - , - , - , - permissions === 'admin' ? ( - - ) : null, - , - permissions === 'admin' ? ( - - ) : ( - - ), - - ]} - - - ) -} + /> + ) : ( + + ), + + ]} + + +) export default App diff --git a/ui/src/authProvider.js b/ui/src/authProvider.js index 58ff2ea6a..f6f8d752b 100644 --- a/ui/src/authProvider.js +++ b/ui/src/authProvider.js @@ -24,7 +24,6 @@ const authProvider = { .then((response) => { // Validate token jwtDecode(response.token) - localStorage.removeItem('initialAccountCreation') localStorage.setItem('token', response.token) localStorage.setItem('name', response.name) localStorage.setItem('username', response.username) @@ -35,6 +34,8 @@ const authProvider = { 'subsonic-token', generateSubsonicToken(password, salt) ) + // Avoid going to create admin dialog after logout/login without a refresh + config.firstTime = false return response }) .catch((error) => { diff --git a/ui/src/dataProvider.js b/ui/src/dataProvider.js index 7e7b15c76..9a9a06784 100644 --- a/ui/src/dataProvider.js +++ b/ui/src/dataProvider.js @@ -1,6 +1,7 @@ import { fetchUtils } from 'react-admin' import jsonServerProvider from 'ra-data-json-server' import baseUrl from './utils/baseUrl' +import config from './config' const restUrl = '/app/api' const customAuthorizationHeader = 'X-ND-Authorization' @@ -19,7 +20,8 @@ const httpClient = (url, options = {}) => { const token = response.headers.get(customAuthorizationHeader) if (token) { localStorage.setItem('token', token) - localStorage.removeItem('initialAccountCreation') + // Avoid going to create admin dialog after logout/login without a refresh + config.firstTime = false } return response })