mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
WS login not working
This commit is contained in:
@@ -94,6 +94,10 @@ export class AuthService {
|
||||
SetSession(response: LoginUserRespose, user:UserForm) {
|
||||
const session: UserSession = Object.assign(SessionStore.user, response)
|
||||
|
||||
console.log('SETSESSION', response, user)
|
||||
console.log('SETSESSION 2', session)
|
||||
|
||||
|
||||
if (response) {
|
||||
if( session.RoleID == 100000014) {
|
||||
session.Profile = 'PR'
|
||||
@@ -141,9 +145,13 @@ export class AuthService {
|
||||
|
||||
//Login to rocketChat server2
|
||||
//user: UserForm
|
||||
async loginChat() {
|
||||
async loginChat(responseChat = this.ValidatedUserChat) {
|
||||
|
||||
const expirationMinutes = 30;
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
|
||||
/* const expirationMinutes = 30;
|
||||
let date = new Date().getTime();
|
||||
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
|
||||
|
||||
@@ -155,7 +163,7 @@ export class AuthService {
|
||||
let responseChat = await this.httpService.post('login', postData).toPromise();
|
||||
|
||||
if(responseChat) {
|
||||
|
||||
console.log()
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
@@ -165,20 +173,21 @@ export class AuthService {
|
||||
this.presentAlert('Network error');
|
||||
}
|
||||
|
||||
this.autoLoginChat(expirationDate.getTime() - date);
|
||||
this.autoLoginChat(expirationDate.getTime() - date); */
|
||||
}
|
||||
|
||||
async autoLoginChat(expirationDate:number) {
|
||||
setTimeout(()=>{
|
||||
this.loginChat();
|
||||
}, expirationDate)
|
||||
/* setTimeout(()=>{
|
||||
this.loginChat(this.ValidatedUserChat);
|
||||
}, expirationDate) */
|
||||
}
|
||||
|
||||
loginToChatWs() {
|
||||
setTimeout(()=>{
|
||||
|
||||
console.log('loginToChatWs')
|
||||
this.WsChatService.connect();
|
||||
this.WsChatService.login().then((message: any) => {
|
||||
console.log('loginToChatWs',message)
|
||||
|
||||
SessionStore.user.RochetChatUserId = message.result.id
|
||||
SessionStore.save()
|
||||
|
||||
Reference in New Issue
Block a user