mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
chores: Improve error
This commit is contained in:
parent
9b737d607a
commit
399cb03fc4
@ -104,7 +104,7 @@ class MockClient implements Client {
|
|||||||
perm = perm.concat(permissions);
|
perm = perm.concat(permissions);
|
||||||
this.permissionsByMap.set(id, perm);
|
this.permissionsByMap.set(id, perm);
|
||||||
|
|
||||||
console.log(`Message ${message}`);
|
console.debug(`Message ${message}`);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,9 +347,6 @@ export default class RestClient implements Client {
|
|||||||
success(maps);
|
success(maps);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log('Maps List Error=>');
|
|
||||||
console.log(error);
|
|
||||||
|
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const errorInfo = this.parseResponseOnError(response);
|
const errorInfo = this.parseResponseOnError(response);
|
||||||
reject(errorInfo);
|
reject(errorInfo);
|
||||||
@ -369,9 +366,7 @@ export default class RestClient implements Client {
|
|||||||
success();
|
success();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
const errorInfo = this.parseResponseOnError(error.response);
|
||||||
const response = error.response;
|
|
||||||
const errorInfo = this.parseResponseOnError(response);
|
|
||||||
reject(errorInfo);
|
reject(errorInfo);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -500,11 +495,13 @@ export default class RestClient implements Client {
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
private parseResponseOnError = (response: any): ErrorInfo => {
|
private parseResponseOnError = (response: any): ErrorInfo => {
|
||||||
|
console.error("Backend error=>");
|
||||||
|
console.error(response.data);
|
||||||
|
|
||||||
let result: ErrorInfo | undefined;
|
let result: ErrorInfo | undefined;
|
||||||
if (response) {
|
if (response) {
|
||||||
const status: number = response.status;
|
const status: number = response.status;
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 401:
|
case 401:
|
||||||
|
@ -344,7 +344,7 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
console.debug(`Starred value map?.starred: ${map?.starred}`);
|
console.debug(`Starred value map?.starred: ${map?.starred}`);
|
||||||
|
|
||||||
return client.updateStarred(id, !map?.starred);
|
return client.updateStarred(id, !(map?.starred));
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user