remove promise bug

This commit is contained in:
Eudes Inácio
2022-12-20 17:06:19 +01:00
parent c8d62760ce
commit 111214d231
22 changed files with 128 additions and 42 deletions
+11 -1
View File
@@ -531,6 +531,7 @@ export class AgendaPage implements OnInit {
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB();
}).finally(() => {
this.showLoader = false;
@@ -589,6 +590,7 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
console.error(error)
this.getFromDB()
})
.finally(() => {
@@ -622,6 +624,7 @@ export class AgendaPage implements OnInit {
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB();
}).finally(() => {
this.showLoader = false;
@@ -646,6 +649,7 @@ export class AgendaPage implements OnInit {
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
this.showLoader = false;
@@ -686,6 +690,7 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
counter++;
@@ -757,6 +762,7 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
this.showLoader = false;
@@ -794,6 +800,7 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
counter++;
@@ -840,6 +847,7 @@ export class AgendaPage implements OnInit {
}
}).catch((error) => {
console.error(error)
this.getFromDB()
})
.finally(() => {
@@ -995,7 +1003,9 @@ export class AgendaPage implements OnInit {
})
}
})
}).catch ((error) => {
console.error(error);
});
}
@@ -148,7 +148,9 @@ export class ViewEventPage implements OnInit {
})
}
})
}).catch ((error) => {
console.error(error);
});
}
+11 -1
View File
@@ -403,10 +403,14 @@ export class ChatPage implements OnInit {
//
//
}).catch((error) => {
console.error('storage getdirectmessagedb: ',error)
})
this.storageservice.get('chatusers').then((users) => {
this.dmUsers = users.filter(data => data.username != SessionStore.user.UserName);
}).catch((error) => {
console.error('storage getchatusers: ',error)
})
} else {
this.sqlservice.getAllChatRoom().then((rooms: any) => {
@@ -557,10 +561,14 @@ export class ChatPage implements OnInit {
//
}).catch((error) => {
console.error('storage getGrup Romm db: ',error)
})
this.storageservice.get('chatusers').then((users) => {
this.dmUsers = users.filter(data => data.username != SessionStore.user.UserName);
}).catch((error) => {
console.error('storage getgrupDb: ',error)
})
} else {
this.sqlservice.getAllChatRoom().then((rooms: any) => {
@@ -662,7 +670,9 @@ export class ChatPage implements OnInit {
else {
//Check if modal is opened
if (this.segment == "Grupos" && this.showGroupMessages != true) {
await new Promise(resolve => setTimeout(resolve, 1000));
await new Promise(resolve => setTimeout(resolve, 1000)).catch ((error) => {
console.error(error);
});
//await this.getGroups();
}
}
@@ -733,7 +733,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
console.error(error);
})));
const blob = this.base64toBlob(encodedData, file.type)
const formData = new FormData();
@@ -977,7 +979,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} else {
//Check if modal is opened
if (document.querySelector('.isGroupChatOpened')) {
await new Promise(resolve => setTimeout(resolve, 5000));
await new Promise(resolve => setTimeout(resolve, 5000)).catch ((error) => {
console.error(error);
});
await this.serverLongPull();
}
+5 -1
View File
@@ -154,6 +154,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// this.chatService.refreshtoken();
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
}).catch((error) => {
console.error(error)
})
this.getChatMembers();
@@ -747,7 +749,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
console.error(error);
})));
const blob = this.base64toBlob(encodedData, file.type)
+3 -1
View File
@@ -195,7 +195,9 @@ export class EventsPage implements OnInit {
if(this.loggeduser.OwnerCalendars.length >= 1) {
let onwEvent:any = await this.eventService.getAllOwnEvents(start, end)
let onwEvent:any = await this.eventService.getAllOwnEvents(start, end).catch((error) => {
console.error(error)
})
this.listToPresent = onwEvent;
this.totalEvent = onwEvent.length;
this.showLoader = false;
@@ -5,7 +5,9 @@ convertBlobToBase64 = (blob) => new Promise((resolve, reject) => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
}).catch ((error) => {
console.error(error);
});;
onmessage = async function(oEvent) {
const result = await convertBlobToBase64(oEvent.data);
@@ -142,6 +142,8 @@ export class NewPublicationPage implements OnInit {
resolve(reader.result);
};
reader.readAsDataURL(blob);
}).catch ((error) => {
console.error(error);
});