mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix storage in chat
This commit is contained in:
@@ -55,7 +55,6 @@ export class AgendaPage implements OnInit {
|
|||||||
showCalendar: boolean;
|
showCalendar: boolean;
|
||||||
calendarHeight: string;
|
calendarHeight: string;
|
||||||
|
|
||||||
|
|
||||||
// for timeline
|
// for timeline
|
||||||
events: CalendarEvent[] = [];
|
events: CalendarEvent[] = [];
|
||||||
// timeline filter
|
// timeline filter
|
||||||
@@ -97,8 +96,6 @@ export class AgendaPage implements OnInit {
|
|||||||
startTime: Date;
|
startTime: Date;
|
||||||
endTime: Date;
|
endTime: Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private alertCtrl: AlertController,
|
private alertCtrl: AlertController,
|
||||||
@Inject(LOCALE_ID) private locale: string,
|
@Inject(LOCALE_ID) private locale: string,
|
||||||
@@ -280,7 +277,6 @@ export class AgendaPage implements OnInit {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export class ChatPage implements OnInit {
|
|||||||
this.authService.userData$.subscribe((res:any)=>{
|
this.authService.userData$.subscribe((res:any)=>{
|
||||||
this.loggedUser=res;
|
this.loggedUser=res;
|
||||||
console.log(this.loggedUser);
|
console.log(this.loggedUser);
|
||||||
|
|
||||||
});
|
});
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export class LoginPage implements OnInit {
|
|||||||
}
|
}
|
||||||
this.authService.loginChat(postData).subscribe((res: any) => {
|
this.authService.loginChat(postData).subscribe((res: any) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
//this.storageService.store(AuthConnstants.AUTH, res.data);
|
this.storageService.store(AuthConnstants.AUTH, res.data);
|
||||||
console.log('Login to Rocket chat OK');
|
console.log('Login to Rocket chat OK');
|
||||||
}, (error: any) => {
|
}, (error: any) => {
|
||||||
console.log('Network error');
|
console.log('Network error');
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export class AuthService {
|
|||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
this.ValidatedUser = user;
|
this.ValidatedUser = user;
|
||||||
//this.storageService.store(AuthConnstants.USER, response);
|
this.storageService.store(AuthConnstants.USER, response);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -80,9 +80,9 @@ export class AuthService {
|
|||||||
|
|
||||||
//Get user data from RocketChat | global object
|
//Get user data from RocketChat | global object
|
||||||
getUserData(){
|
getUserData(){
|
||||||
/* this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||||
this.userData$.next(res);
|
this.userData$.next(res);
|
||||||
}); */
|
});
|
||||||
}
|
}
|
||||||
//Get user Id | global object
|
//Get user Id | global object
|
||||||
getUserId(){
|
getUserId(){
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
/* import { Plugins } from '@capacitor/core';
|
/* import { Plugins } from '@capacitor/core';
|
||||||
const { Storage } = Plugins; */
|
const { Storage } = Plugins; */
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StorageService {
|
export class StorageService {
|
||||||
constructor() {}
|
constructor(private storage:Storage,) {}
|
||||||
|
|
||||||
/* // Store the value
|
// Store the value
|
||||||
async store(storageKey: string, value: any) {
|
async store(key: string, value: any){
|
||||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||||
await Storage.set({
|
await this.storage.set(key, encryptedValue);
|
||||||
key: storageKey,
|
|
||||||
value: encryptedValue
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// Get the value
|
||||||
|
async get(key: string) {
|
||||||
|
const ret = await this.storage.get(key).then((val) => {
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
return JSON.parse(unescape(atob(ret)));
|
||||||
|
}
|
||||||
|
/*
|
||||||
// Get the value
|
// Get the value
|
||||||
async get(storageKey: string) {
|
async get(storageKey: string) {
|
||||||
const ret = await Storage.get({ key: storageKey });
|
const ret = await Storage.get({ key: storageKey });
|
||||||
|
|||||||
Reference in New Issue
Block a user