mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Add "new-group" and "contacts" pages
- Style new group page - Improve style in chat page
This commit is contained in:
@@ -1,24 +1,30 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { AuthConnstants } from '../config/auth-constants';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class StorageService {
|
||||
user: any = "Max";
|
||||
storageKey = "user";
|
||||
constructor(private storage: Storage) {}
|
||||
|
||||
// Store the value
|
||||
async store(value: any) {
|
||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||
await this.storage.set('user', encryptedValue);;
|
||||
// set a key/value2
|
||||
store(user:any){
|
||||
const encryptedValue = btoa(escape(JSON.stringify(user)));
|
||||
this.storage.set(AuthConnstants.AUTH, encryptedValue);
|
||||
}
|
||||
|
||||
// Get the value
|
||||
async get() {
|
||||
const ret = await this.storage.get('user').then(res=>{
|
||||
return JSON.parse(unescape(atob(ret.value)));
|
||||
});
|
||||
|
||||
|
||||
// Or to get a key/value pair
|
||||
get(key:any){
|
||||
let user = this.storage.get(key).then((val) => {
|
||||
console.log(JSON.parse(unescape(atob(val))).data);
|
||||
return JSON.parse(unescape(atob(val))).data;
|
||||
});
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
/* async removeStorageItem(storageKey: string) {
|
||||
await this.storage.remove({ key: storageKey });
|
||||
|
||||
Reference in New Issue
Block a user