mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve create publication
This commit is contained in:
@@ -12,7 +12,7 @@ import { AESEncrypt } from '../services/aesencrypt.service';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
import { NfService } from 'src/app/services/chat/nf.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
@@ -97,10 +97,6 @@ export class AuthService {
|
||||
SetSession(response: LoginUserRespose, user:UserForm) {
|
||||
const session: UserSession = Object.assign(SessionStore.user, response)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (response) {
|
||||
if( session.RoleID == 100000014) {
|
||||
session.Profile = 'PR'
|
||||
@@ -124,58 +120,25 @@ export class AuthService {
|
||||
this.initialsService.getInitials(session.FullName);
|
||||
}
|
||||
|
||||
//Login to rocketChat server2
|
||||
//user: UserForm
|
||||
async loginChat(responseChat = this.ValidatedUserChat) {
|
||||
|
||||
if(SessionStore?.user?.ChatData) {
|
||||
this.ValidatedUserChat = SessionStore.user.ChatData
|
||||
}
|
||||
|
||||
/* const expirationMinutes = 30;
|
||||
let date = new Date().getTime();
|
||||
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
|
||||
|
||||
let postData = {
|
||||
"user": SessionStore.user.UserName,
|
||||
"password": SessionStore.user.Password,
|
||||
}
|
||||
|
||||
let responseChat = await this.httpService.post('login', postData).toPromise();
|
||||
|
||||
if(responseChat) {
|
||||
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
}
|
||||
else{
|
||||
|
||||
this.presentAlert('Network error');
|
||||
}
|
||||
|
||||
this.autoLoginChat(expirationDate.getTime() - date); */
|
||||
}
|
||||
|
||||
async autoLoginChat(expirationDate:number) {
|
||||
/* setTimeout(()=>{
|
||||
this.loginChat(this.ValidatedUserChat);
|
||||
}, expirationDate) */
|
||||
}
|
||||
|
||||
loginToChatWs() {
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
|
||||
this.RochetChatConnectorService.connect();
|
||||
this.RochetChatConnectorService.login().then((message: any) => {
|
||||
|
||||
|
||||
SessionStore.user.RochetChatUserId = message.result.id
|
||||
SessionStore.save()
|
||||
|
||||
//
|
||||
|
||||
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -185,7 +148,6 @@ export class AuthService {
|
||||
// alert('wsLogin')
|
||||
|
||||
}).catch((message) => {
|
||||
|
||||
// alert('ws login failed')
|
||||
})
|
||||
|
||||
@@ -239,8 +201,6 @@ export class AuthService {
|
||||
if (message.file.type == "application/img") {
|
||||
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
|
||||
|
||||
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//
|
||||
@@ -267,7 +227,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
autologout(expirationDate:number) {
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.logout();
|
||||
}, expirationDate)
|
||||
}
|
||||
@@ -278,14 +238,14 @@ export class AuthService {
|
||||
localStorage.removeItem('userChat');
|
||||
|
||||
SessionStore.setInativity(false)
|
||||
SessionStore.setUrlBeforeInactivity(this.router.url)
|
||||
SessionStore.setUrlBeforeInactivity(this.router.url);
|
||||
setTimeout(() => {
|
||||
this.router.navigateByUrl('/', { replaceUrl: true });
|
||||
}, 100)
|
||||
|
||||
}
|
||||
|
||||
//Get user data from RocketChat | global object
|
||||
// Get user data from RocketChat | global object
|
||||
getUserData() {
|
||||
this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
this.userData$.next(res);
|
||||
@@ -293,11 +253,6 @@ export class AuthService {
|
||||
}
|
||||
|
||||
logoutChat() {
|
||||
//this.storageService.clear();
|
||||
/* this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||
this.userData$.next('');
|
||||
this.router.navigate(['']);
|
||||
}) */
|
||||
}
|
||||
|
||||
async presentAlert(message: string) {
|
||||
|
||||
@@ -599,8 +599,6 @@ export class ChatSystemService {
|
||||
this.loadingUsers = true
|
||||
let _res
|
||||
|
||||
// console.log('getuser')
|
||||
|
||||
try {
|
||||
_res = await this.ChatService.getAllUsers().toPromise();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user