listpage-next 0.0.270 → 0.0.272

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.
@@ -5,10 +5,12 @@ function setupBaseUrl(HttpClient) {
5
5
  const host = server?.host || location.hostname;
6
6
  const port = server?.port || location.port;
7
7
  if (config?.baseURL) {
8
- if (config.baseURL.startsWith('/')) return `${protocol}//${host}:${port}${config.baseURL}`;
9
- return config.baseURL;
8
+ let baseURL = config?.baseURL;
9
+ if (!baseURL.endsWith('/')) baseURL += '/';
10
+ if (baseURL.startsWith('/')) baseURL = `${protocol}//${host}:${port}${baseURL}`;
11
+ return baseURL;
10
12
  }
11
- return `${protocol}//${host}:${port}${server?.publicPath}`;
13
+ return `${protocol}//${host}:${port}${server?.publicPath || ''}${server?.publicPath?.endsWith('/') ? '' : '/'}`;
12
14
  };
13
15
  }
14
16
  function mergeServerConfig(server) {
@@ -60,8 +60,8 @@ function setupClient(HttpClient) {
60
60
  data: error.response.data
61
61
  };
62
62
  notification.error({
63
- message: error.code,
64
- description: error.message
63
+ message: apiError.code,
64
+ description: apiError.message
65
65
  });
66
66
  return Promise.reject(apiError);
67
67
  }
@@ -75,6 +75,7 @@ function setupClient(HttpClient) {
75
75
  };
76
76
  HttpClient.prototype.sse = async function(url, data) {
77
77
  const baseUrl = this.getBaseURL();
78
+ if (url.startsWith('/')) url = url.slice(1);
78
79
  const uri = new URL(url, baseUrl);
79
80
  let headers = this.getHeaders();
80
81
  headers.Authorization = `Bearer ${this.getToken()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.270",
3
+ "version": "0.0.272",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",