@andersonalmeidax0/webcomponents 0.1.22 → 0.1.24
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/RestAPIAdapter.js +14 -10
- package/jzcomponents/ErrorCard.jsx +3 -6
- package/package.json +1 -1
- package/releasenotes.txt +4 -0
package/RestAPIAdapter.js
CHANGED
|
@@ -120,8 +120,8 @@ class RestAPIAdapter {
|
|
|
120
120
|
var r = null;
|
|
121
121
|
r = await response.json();
|
|
122
122
|
if (this.DEBUG_APIFETCH) alert(JSON.stringify(r, null, 2));
|
|
123
|
-
if (r.error)
|
|
124
|
-
|
|
123
|
+
//if (r.error)
|
|
124
|
+
// throw new PlatAPIReturnCodeError(r.error.message);
|
|
125
125
|
return r;
|
|
126
126
|
}
|
|
127
127
|
/** ***********************
|
|
@@ -139,14 +139,18 @@ class RestAPIAdapter {
|
|
|
139
139
|
url = (this.urlServer == null) ? url : this.urlServer + url;
|
|
140
140
|
|
|
141
141
|
const response = await this.myFetch3(ptoken, url, method, body);
|
|
142
|
+
alert(response.status)
|
|
142
143
|
if (!response.ok) {
|
|
144
|
+
alert("callapi staatu:"+response.status)
|
|
145
|
+
r = await this.getJSONResponse(response);
|
|
146
|
+
alert("callapi ret err:"+JSON.stringify(r));
|
|
143
147
|
if (response.status === 404)
|
|
144
|
-
throw new PlatAPIDBNotFound(`An error has occured: ${response.status}
|
|
148
|
+
throw new PlatAPIDBNotFound(`An error has occured: ${response.status}`+' message:'+JSON.stringify(r));
|
|
145
149
|
if (response.status === 403)
|
|
146
|
-
throw new PlatAPIForbidden(`An error has occured: ${response.status}
|
|
150
|
+
throw new PlatAPIForbidden(`An error has occured: ${response.status}`+' message:'+JSON.stringify(r));
|
|
147
151
|
if (response.status === 401)
|
|
148
|
-
throw new PlatAPIAuthError(`An error has occured: ${response.status}
|
|
149
|
-
throw new PlatAPIReturnCodeError();
|
|
152
|
+
throw new PlatAPIAuthError(`An error has occured: ${response.status}`+' message:'+JSON.stringify(r));
|
|
153
|
+
throw new PlatAPIReturnCodeError(`An error has occured: ${response.status}`+' message:'+JSON.stringify(r));
|
|
150
154
|
}
|
|
151
155
|
r = await this.getJSONResponse(response);
|
|
152
156
|
|
|
@@ -176,7 +180,7 @@ class RestAPIAdapter {
|
|
|
176
180
|
*
|
|
177
181
|
*********************** */
|
|
178
182
|
async uploadFile(fileData) {
|
|
179
|
-
alert('UPLOAD start:' + this.urlServer + '/upload');
|
|
183
|
+
//alert('UPLOAD start:' + this.urlServer + '/upload');
|
|
180
184
|
let formData = new FormData();
|
|
181
185
|
formData.append('file', fileData);
|
|
182
186
|
const response = await fetch(this.urlServer + '/upload', {
|
|
@@ -192,15 +196,15 @@ class RestAPIAdapter {
|
|
|
192
196
|
throw new PlatAPIAuthError(`An error has occured: ${response.status}`);
|
|
193
197
|
throw new PlatAPIReturnCodeError();
|
|
194
198
|
}
|
|
195
|
-
alert("uploadfile vao ver r");
|
|
199
|
+
//alert("uploadfile vao ver r");
|
|
196
200
|
var r = await response.json();
|
|
197
|
-
alert("upload response:" + JSON.stringify(r));
|
|
201
|
+
//alert("upload response:" + JSON.stringify(r));
|
|
198
202
|
return r;
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
|
|
202
206
|
async download(fname) {
|
|
203
|
-
alert('UPLOAD start:' + this.urlServer + '/download/' + fname);
|
|
207
|
+
//alert('UPLOAD start:' + this.urlServer + '/download/' + fname);
|
|
204
208
|
var response = await fetch(this.urlServer + '/download/' + fname, {
|
|
205
209
|
method: 'GET'
|
|
206
210
|
})
|
|
@@ -5,12 +5,9 @@ export class ErrorCard extends React.Component {
|
|
|
5
5
|
return (
|
|
6
6
|
<div className="g--10 m--2">
|
|
7
7
|
<h3>Erro de sistema inesperado. Entre em contato com suporte e informe a mensagem abaixo:</h3>
|
|
8
|
-
<h4>{
|
|
9
|
-
<h4>{
|
|
10
|
-
<
|
|
11
|
-
<div> <div className=""> <p> <a href='/loginExternal'>Entrar novamente.</a> </p> </div> <span> </span>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
8
|
+
<h4>Error name:{(this.props.myException.name)}</h4>
|
|
9
|
+
<h4>Error message:{(this.props.myException.message)}</h4>
|
|
10
|
+
<h4>Error Stack:{(this.props.myException.stack)}</h4>
|
|
14
11
|
</div>
|
|
15
12
|
);
|
|
16
13
|
}
|
package/package.json
CHANGED
package/releasenotes.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
WebComponents
|
|
2
|
+
|
|
1
3
|
0.1.0: beta
|
|
2
4
|
0.1.1: add all components
|
|
3
5
|
0.1.2: with text labels for buttons
|
|
@@ -14,6 +16,8 @@
|
|
|
14
16
|
0.1.14: RestAPIAdapter => (Part 2: CREATE: file upload REST API / Part3: show fileField on list with download link
|
|
15
17
|
0.1.15: fix bug
|
|
16
18
|
0.1.16: fix bug2
|
|
19
|
+
0.1.23: fix bugs
|
|
20
|
+
0.1.24: show errors
|
|
17
21
|
|
|
18
22
|
npm login
|
|
19
23
|
npm publish --access public
|