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