@semapps/semantic-data-provider 1.1.5 → 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 CHANGED
@@ -1046,15 +1046,18 @@ var $ceaafb56f75454f0$export$2e2bcd8739ae039 = $ceaafb56f75454f0$var$updateMetho
1046
1046
  */ const $341dff85fe619d85$var$httpClient = (dataServers)=>(url, options = {})=>{
1047
1047
  if (!url) throw new Error(`No URL provided on httpClient call`);
1048
1048
  const token = localStorage.getItem('token');
1049
- let webId = localStorage.getItem('webId');
1050
- if (!webId) {
1051
- const payload = (0, ($parcel$interopDefault($bkNnK$jwtdecode)))(token);
1052
- webId = payload.webId || payload.webid; // Currently we must deal with both formats
1053
- localStorage.setItem('webId', webId);
1049
+ let webId;
1050
+ if (token) {
1051
+ webId = localStorage.getItem('webId');
1052
+ if (!webId) {
1053
+ const payload = (0, ($parcel$interopDefault($bkNnK$jwtdecode)))(token);
1054
+ webId = payload.webId || payload.webid; // Currently we must deal with both formats
1055
+ localStorage.setItem('webId', webId);
1056
+ }
1054
1057
  }
1055
1058
  const authServerKey = (0, $8f44b7c15b8b8e1d$export$2e2bcd8739ae039)('authServer', dataServers);
1056
1059
  const serverKey = (0, $59a07b932dae8600$export$2e2bcd8739ae039)(url, dataServers);
1057
- const useProxy = serverKey !== authServerKey && dataServers[webId]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;
1060
+ const useProxy = serverKey !== authServerKey && webId && dataServers[webId]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;
1058
1061
  if (!options.headers) options.headers = new Headers();
1059
1062
  switch(options.method){
1060
1063
  case 'POST':