mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
set data to store
This commit is contained in:
@@ -19,6 +19,7 @@ import { Platform } from '@ionic/angular';
|
||||
import { FirstEnterService } from '../../services/first-enter.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { DocumentManagementStore } from 'src/app/store/documentManagement';
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.page.html',
|
||||
@@ -38,6 +39,7 @@ export class LoginPage implements OnInit {
|
||||
sessionStore = SessionStore;
|
||||
showPassword = false;
|
||||
passwordIcon = "eye";
|
||||
DocumentManagementStore = DocumentManagementStore
|
||||
|
||||
constructor(
|
||||
private notificatinsservice: NotificationsService,
|
||||
@@ -152,6 +154,7 @@ export class LoginPage implements OnInit {
|
||||
window.localStorage.clear();
|
||||
await MessageModel.deleteAll();
|
||||
await DeleteMessageModel.deleteAll();
|
||||
this.DocumentManagementStore.clear();
|
||||
this.storage.clear();
|
||||
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
|
||||
@@ -19,6 +19,7 @@ import { InitialsService } from './functions/initials.service';
|
||||
import { PermissionService } from './permission.service';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { DocumentManagementStore } from '../store/documentManagement';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -32,6 +33,8 @@ export class AuthService {
|
||||
|
||||
tabIsActive = true
|
||||
|
||||
DocumentManagementStore = DocumentManagementStore
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private storageService:StorageService,
|
||||
@@ -116,10 +119,8 @@ export class AuthService {
|
||||
|
||||
if(saveSession) {
|
||||
/* this.SetSession(response, user) */
|
||||
this.storageService.store('userContentProduction',response)
|
||||
this.storageService.get('userContentProduction').then((value) =>{
|
||||
console.log('JWW', value.AuthorizationJwt);
|
||||
})
|
||||
this.DocumentManagementStore.setData(response)
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { localstoreService } from './localstore.service'
|
||||
|
||||
export class documentManagementStore {
|
||||
|
||||
session: {
|
||||
static session: {
|
||||
UserId: number,
|
||||
Email: string,
|
||||
UserName: string
|
||||
@@ -17,18 +17,18 @@ export class documentManagementStore {
|
||||
AuthorizationJwt: string
|
||||
}
|
||||
|
||||
get keyName() {
|
||||
static get keyName() {
|
||||
return SHA1("documentManagement").toString()
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
static setData(data) {
|
||||
this.session = data
|
||||
localstoreService.set(this.keyName, {
|
||||
user: this.session
|
||||
})
|
||||
}
|
||||
|
||||
clear() {
|
||||
static clear() {
|
||||
delete this.session
|
||||
localstoreService.delete(this.keyName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user