@gandalan/weblibs 1.0.9 → 1.0.10

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/api/RESTClient.js CHANGED
@@ -21,6 +21,8 @@ export class RESTClient {
21
21
  this.token = token;
22
22
  this.isJWT = isJWT;
23
23
 
24
+ axios.defaults.baseURL = url;
25
+
24
26
  if (this.token && !isJWT) {
25
27
  axios.defaults.headers.common["X-Gdl-AuthToken"] = this.token;
26
28
  }
@@ -96,7 +98,7 @@ export class RESTClient {
96
98
 
97
99
  async refreshToken() {
98
100
  try {
99
- await axios.put(`${this.baseurl}/LoginJwt/Refresh`, { token: localStorage.getItem("IDAS_AuthJwtRefreshToken") })
101
+ await this.put("/LoginJwt/Refresh", { token: localStorage.getItem("IDAS_AuthJwtRefreshToken") })
100
102
  .then(resp => {
101
103
  this.updateJwtToken(resp.data);
102
104
  });
@@ -120,7 +122,7 @@ export class RESTClient {
120
122
 
121
123
  async get(uri, noJWT = false) {
122
124
  try {
123
- const response = await axios.get(this.baseurl + uri, this.getUrlOptions(noJWT));
125
+ const response = await axios.get(uri, this.getUrlOptions(noJWT));
124
126
  this.lastError = "";
125
127
  return response.data;
126
128
  } catch (error) {
@@ -130,7 +132,7 @@ export class RESTClient {
130
132
 
131
133
  async getFile(uri) {
132
134
  try {
133
- const response = await axios.get(this.baseurl + uri, { responseType: "blob" });
135
+ const response = await axios.get(uri, { responseType: "blob" });
134
136
  let fileName = "1000.pdf";
135
137
  if (response.headers["content-disposition"]) {
136
138
  fileName = response.headers["content-disposition"].split(";")[1];
@@ -146,7 +148,7 @@ export class RESTClient {
146
148
  async getRaw(uri, noJWT = false) {
147
149
  let response = {};
148
150
  try {
149
- response = await axios.get(this.baseurl + uri, this.getUrlOptions(noJWT))
151
+ response = await axios.get(uri, this.getUrlOptions(noJWT))
150
152
  this.lastError = "";
151
153
  } catch (error) {
152
154
  this.handleError(error);
@@ -156,7 +158,7 @@ export class RESTClient {
156
158
 
157
159
  async post(uri, formData, noJWT = false) {
158
160
  try {
159
- const response = await axios.post(this.baseurl + uri, formData, this.getUrlOptions(noJWT));
161
+ const response = await axios.post(uri, formData, this.getUrlOptions(noJWT));
160
162
  this.lastError = "";
161
163
  return response;
162
164
  } catch (error) {
@@ -166,7 +168,7 @@ export class RESTClient {
166
168
 
167
169
  async put(uri, formData, noJWT = false) {
168
170
  try {
169
- const response = await axios.put(this.baseurl + uri, formData, this.getUrlOptions(noJWT));
171
+ const response = await axios.put(uri, formData, this.getUrlOptions(noJWT));
170
172
  this.lastError = "";
171
173
  return response;
172
174
  } catch (error) {
@@ -176,7 +178,7 @@ export class RESTClient {
176
178
 
177
179
  async delete(uri, noJWT = false) {
178
180
  try {
179
- const response = await axios.delete(this.baseurl + uri, this.getUrlOptions(noJWT));
181
+ const response = await axios.delete(uri, this.getUrlOptions(noJWT));
180
182
  this.lastError = "";
181
183
  return response;
182
184
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "keywords": [
6
6
  "gandalan"