Login
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SessionDataProviderService } from './session-data-provider.service';
|
||||
|
||||
describe('SessionDataProviderService', () => {
|
||||
let service: SessionDataProviderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(SessionDataProviderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,113 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SessionDataProviderService {
|
||||
|
||||
constructor() {
|
||||
console.log('Hello SessionDataProvider Store');
|
||||
}
|
||||
|
||||
firstname: string = "";
|
||||
lastname:string = "";
|
||||
session: string = "";
|
||||
balance:number =0;
|
||||
username:string="";
|
||||
last_login:string="";
|
||||
member_id:number = 0;
|
||||
ccard:number=0;
|
||||
isPedningJob: number = 0;
|
||||
isOfferJob: number = 0;
|
||||
profile_pic:string='';
|
||||
|
||||
session_contructed:boolean = false;
|
||||
|
||||
|
||||
ConstructGlobalSessionData(loginResult: any) {
|
||||
console.log('Hello ConstructGlobalSessionData Provider');
|
||||
this.session_contructed=false;
|
||||
|
||||
try {
|
||||
console.log(loginResult);
|
||||
|
||||
this.firstname = loginResult.firstname;
|
||||
this.lastname = loginResult.lastname;
|
||||
this.session = loginResult.session;
|
||||
this.session_contructed=loginResult.balance;
|
||||
this.username=loginResult.username;
|
||||
this.last_login = loginResult.last_login2;
|
||||
this.member_id = loginResult.member_id;
|
||||
this.balance = loginResult.balance;
|
||||
this.ccard=loginResult.ccard;
|
||||
this.profile_pic=loginResult.profile_pic;
|
||||
this.isPedningJob = loginResult.pedningjob;
|
||||
this.isOfferJob = loginResult.offerjob;
|
||||
|
||||
//this.pushNotificationProvider.tagUser(this.session);
|
||||
|
||||
this.session_contructed = true;
|
||||
|
||||
// this.SessionUser.added = loginResult.added;
|
||||
/* this.SessionUser.added = "";
|
||||
this.SessionUser.balance = loginResult.balance;
|
||||
this.SessionUser.city = loginResult.city;
|
||||
this.SessionUser.country = loginResult.country;
|
||||
this.SessionUser.email = loginResult.email;
|
||||
this.SessionUser.fb_id = loginResult.fb_id;
|
||||
this.SessionUser.firstname = loginResult.firstname;
|
||||
this.SessionUser.id = loginResult.id;
|
||||
this.SessionUser.last_login = loginResult.last_login;
|
||||
this.SessionUser.loc = loginResult.loc;
|
||||
this.SessionUser.member_id = loginResult.member_id;
|
||||
|
||||
this.SessionUser.news = loginResult.news;
|
||||
this.SessionUser.phone = loginResult.phone;
|
||||
this.SessionUser.post_jobs = loginResult.post_jobs;
|
||||
this.SessionUser.profile_pic = loginResult.profile_pic;
|
||||
this.SessionUser.session = loginResult.session;
|
||||
|
||||
this.SessionUser = {
|
||||
added: loginResult.added,
|
||||
balance: loginResult.balance,
|
||||
city: loginResult.city,
|
||||
country: loginResult.country,
|
||||
email: loginResult.email,
|
||||
fb_id: loginResult.fb_id,
|
||||
firstname: loginResult.firstname,
|
||||
id: loginResult.id,
|
||||
last_login: loginResult.last_login,
|
||||
lastname: loginResult.lastname,
|
||||
loc: loginResult.loc,
|
||||
member_id: loginResult.member_id,
|
||||
news: loginResult.news,
|
||||
phone: loginResult.phone,
|
||||
post_jobs: loginResult.post_jobs,
|
||||
profile_pic: loginResult.profile_pic,
|
||||
refer: loginResult.refer,
|
||||
session: loginResult.session,
|
||||
state: loginResult.state,
|
||||
status: loginResult.status,
|
||||
username: loginResult.username
|
||||
};
|
||||
|
||||
|
||||
this.storage.set('sessionuser', JSON.stringify(this.SessionUser));
|
||||
*/
|
||||
} catch (error) {
|
||||
console.log("LOGIN STORAGE ERROR->" + error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return this.session_contructed;
|
||||
}
|
||||
|
||||
profilePicture(){
|
||||
var profile_p = '';
|
||||
if (this.profile_pic !=''){
|
||||
profile_p="https://www.wrenchboard.com/smedia/LIVE/profile/"+this.profile_pic;
|
||||
}
|
||||
return profile_p;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user