mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
performace
This commit is contained in:
@@ -33,7 +33,7 @@ export class AuthService {
|
||||
opts:any;
|
||||
|
||||
tabIsActive = true
|
||||
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private storageService:StorageService,
|
||||
@@ -62,7 +62,7 @@ export class AuthService {
|
||||
if(!this.tabIsActive) {
|
||||
this.tabIsActive = true
|
||||
const data = SessionStore.getDataFromLocalStorage();
|
||||
|
||||
|
||||
if(!data?.user?.Authorization && SessionStore?.user?.Authorization) {
|
||||
window.location.reload();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export class AuthService {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('blur', (event) => {
|
||||
this.tabIsActive = false
|
||||
});
|
||||
@@ -91,7 +91,7 @@ export class AuthService {
|
||||
|
||||
try {
|
||||
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
|
||||
|
||||
|
||||
if(saveSession) {
|
||||
this.SetSession(response, user)
|
||||
@@ -152,7 +152,7 @@ export class AuthService {
|
||||
}else {
|
||||
session.Profile = 'Unknown'
|
||||
}
|
||||
|
||||
|
||||
session.Password = user.password
|
||||
session.BasicAuthKey = user.BasicAuthKey
|
||||
SessionStore.reset(session)
|
||||
@@ -165,11 +165,11 @@ export class AuthService {
|
||||
|
||||
loginToChatWs() {
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
if(SessionStore.user.ChatData?.data) {
|
||||
this.RochetChatConnectorService.connect();
|
||||
this.RochetChatConnectorService.login().then((message: any) => {
|
||||
|
||||
|
||||
SessionStore.user.RochetChatUserId = message.result.id
|
||||
SessionStore.save()
|
||||
|
||||
@@ -179,13 +179,13 @@ export class AuthService {
|
||||
this.ChatSystemService.getAllRooms();
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
}, 200);
|
||||
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
// console.error(SessionStore.user.ChatData, 'web socket login',error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// before sending a message with a attachment
|
||||
@@ -200,6 +200,7 @@ export class AuthService {
|
||||
message.file.guid = guid.path
|
||||
|
||||
message.downloadFileMsg()
|
||||
message.uploadingFile = false
|
||||
|
||||
return true
|
||||
} catch(e) {
|
||||
@@ -219,10 +220,11 @@ export class AuthService {
|
||||
message.attachments[0].title_link = url_no_options
|
||||
message.attachments[0].message_link = url_no_options
|
||||
|
||||
return true
|
||||
message.uploadingFile = false
|
||||
|
||||
return true
|
||||
} catch(e) {
|
||||
window['e'] = e
|
||||
window['e'] = e
|
||||
console.error('BeforesendAtachment', e)
|
||||
message.uploadingFile = false
|
||||
return false
|
||||
@@ -235,7 +237,7 @@ export class AuthService {
|
||||
|
||||
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
|
||||
|
||||
//
|
||||
//
|
||||
let downloadFile = "";
|
||||
if (message.file.type == "application/img") {
|
||||
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
|
||||
@@ -279,7 +281,7 @@ export class AuthService {
|
||||
|
||||
logoutChat() {
|
||||
}
|
||||
|
||||
|
||||
async presentAlert(message: string) {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
|
||||
Reference in New Issue
Block a user