Skip to content

🎧 Your Personal Streaming Service

Fix regular users not able to edit their info before logging in again

Deluan88f2fc35cd8e
diff --git a/ui/src/dataProvider/httpClient.js b/ui/src/dataProvider/httpClient.js
index 153c2cbd6..02e78ca83 100644
--- a/ui/src/dataProvider/httpClient.js
+++ b/ui/src/dataProvider/httpClient.js
@@ -1,6 +1,7 @@
import { fetchUtils } from 'react-admin'
import { baseUrl } from '../utils'
import config from '../config'
+import jwtDecode from 'jwt-decode'
const customAuthorizationHeader = 'X-ND-Authorization'
@@ -16,7 +17,9 @@ const httpClient = (url, options = {}) => {
return fetchUtils.fetchJson(url, options).then((response) => {
const token = response.headers.get(customAuthorizationHeader)
if (token) {
+ const decoded = jwtDecode(token)
localStorage.setItem('token', token)
+ localStorage.setItem('userId', decoded.uid)
// Avoid going to create admin dialog after logout/login without a refresh
config.firstTime = false
}