Remove unused localStorage config
This commit is contained in:
+3
-19
@@ -26,18 +26,7 @@ const i18nProvider = polyglotI18nProvider(
|
|||||||
|
|
||||||
const history = createHashHistory()
|
const history = createHashHistory()
|
||||||
|
|
||||||
const App = () => {
|
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 (
|
|
||||||
<Provider
|
<Provider
|
||||||
store={createAdminStore({
|
store={createAdminStore({
|
||||||
authProvider,
|
authProvider,
|
||||||
@@ -60,11 +49,7 @@ const App = () => {
|
|||||||
loginPage={Login}
|
loginPage={Login}
|
||||||
>
|
>
|
||||||
{(permissions) => [
|
{(permissions) => [
|
||||||
<Resource
|
<Resource name="artist" {...artist} options={{ subMenu: 'library' }} />,
|
||||||
name="artist"
|
|
||||||
{...artist}
|
|
||||||
options={{ subMenu: 'library' }}
|
|
||||||
/>,
|
|
||||||
<Resource name="album" {...album} options={{ subMenu: 'library' }} />,
|
<Resource name="album" {...album} options={{ subMenu: 'library' }} />,
|
||||||
<Resource name="song" {...song} options={{ subMenu: 'library' }} />,
|
<Resource name="song" {...song} options={{ subMenu: 'library' }} />,
|
||||||
<Resource name="albumSong" />,
|
<Resource name="albumSong" />,
|
||||||
@@ -89,7 +74,6 @@ const App = () => {
|
|||||||
]}
|
]}
|
||||||
</Admin>
|
</Admin>
|
||||||
</Provider>
|
</Provider>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
export default App
|
export default App
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const authProvider = {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
// Validate token
|
// Validate token
|
||||||
jwtDecode(response.token)
|
jwtDecode(response.token)
|
||||||
localStorage.removeItem('initialAccountCreation')
|
|
||||||
localStorage.setItem('token', response.token)
|
localStorage.setItem('token', response.token)
|
||||||
localStorage.setItem('name', response.name)
|
localStorage.setItem('name', response.name)
|
||||||
localStorage.setItem('username', response.username)
|
localStorage.setItem('username', response.username)
|
||||||
@@ -35,6 +34,8 @@ const authProvider = {
|
|||||||
'subsonic-token',
|
'subsonic-token',
|
||||||
generateSubsonicToken(password, salt)
|
generateSubsonicToken(password, salt)
|
||||||
)
|
)
|
||||||
|
// Avoid going to create admin dialog after logout/login without a refresh
|
||||||
|
config.firstTime = false
|
||||||
return response
|
return response
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { fetchUtils } from 'react-admin'
|
import { fetchUtils } from 'react-admin'
|
||||||
import jsonServerProvider from 'ra-data-json-server'
|
import jsonServerProvider from 'ra-data-json-server'
|
||||||
import baseUrl from './utils/baseUrl'
|
import baseUrl from './utils/baseUrl'
|
||||||
|
import config from './config'
|
||||||
|
|
||||||
const restUrl = '/app/api'
|
const restUrl = '/app/api'
|
||||||
const customAuthorizationHeader = 'X-ND-Authorization'
|
const customAuthorizationHeader = 'X-ND-Authorization'
|
||||||
@@ -19,7 +20,8 @@ const httpClient = (url, options = {}) => {
|
|||||||
const token = response.headers.get(customAuthorizationHeader)
|
const token = response.headers.get(customAuthorizationHeader)
|
||||||
if (token) {
|
if (token) {
|
||||||
localStorage.setItem('token', 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
|
return response
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user