@semapps/semantic-data-provider 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +9 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +9 -6
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -992,15 +992,18 @@ var $c5031381f4dfc62d$export$2e2bcd8739ae039 = $c5031381f4dfc62d$var$updateMetho
|
|
|
992
992
|
*/ const $22b4895a4ca7d626$var$httpClient = (dataServers)=>(url, options = {})=>{
|
|
993
993
|
if (!url) throw new Error(`No URL provided on httpClient call`);
|
|
994
994
|
const token = localStorage.getItem('token');
|
|
995
|
-
let webId
|
|
996
|
-
if (
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
995
|
+
let webId;
|
|
996
|
+
if (token) {
|
|
997
|
+
webId = localStorage.getItem('webId');
|
|
998
|
+
if (!webId) {
|
|
999
|
+
const payload = (0, $fj9kP$jwtdecode)(token);
|
|
1000
|
+
webId = payload.webId || payload.webid; // Currently we must deal with both formats
|
|
1001
|
+
localStorage.setItem('webId', webId);
|
|
1002
|
+
}
|
|
1000
1003
|
}
|
|
1001
1004
|
const authServerKey = (0, $8326b88c1a913ca9$export$2e2bcd8739ae039)('authServer', dataServers);
|
|
1002
1005
|
const serverKey = (0, $47e21ee81eed09a6$export$2e2bcd8739ae039)(url, dataServers);
|
|
1003
|
-
const useProxy = serverKey !== authServerKey && dataServers[webId]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;
|
|
1006
|
+
const useProxy = serverKey !== authServerKey && webId && dataServers[webId]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;
|
|
1004
1007
|
if (!options.headers) options.headers = new Headers();
|
|
1005
1008
|
switch(options.method){
|
|
1006
1009
|
case 'POST':
|