Files
WrenchBoardIonic2023/src/app/store/session-data-provider.service.ts
T
CHIEFSOFT\ameye 5377b1520f Remin pareent
2023-09-24 17:32:03 -04:00

194 lines
5.9 KiB
TypeScript

import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class SessionDataProviderService {
constructor() {
console.log('Hello SessionDataProvider Store');
}
/*
"account_type": "FULL",
"added": "2016-09-22 23:26:29.916445",
"balance": "93468334",
"ccard": "0",
"city": "Atlanta3",
"country": "NG",
"email": "ses66181+new39@gmail.com",
"external_idp_provider": "",
"external_idp_provider_id": "",
"family_level": "0",
"firstname": "First68",
"id": "1",
"last_login": "2023-08-15 12:58:19.879022",
"last_login2": "Tuesday Aug 15, 2023 12:58 PM",
"lastname": "Last32",
"loc": "10.10.33.15",
"member_id": "1",
"news": "0",
"online_name": "Online Name61",
"password": "",
"phone": "",
"post_jobs": "2017-07-24 08:33:35.599175",
"pref_email": "1",
"pref_phone": "1",
"profile_pic": "1.jpg",
"profile_pic_url": "https:\/\/www.wrenchboard.com\/assets\/images\/profile.jpg",
"promo": "0",
"refer": "2017-10-30 12:44:06.660273",
"result": "YES I GET TO BACK END",
"server_name": "https:\/\/dev-users.wrenchboard.com",
"session": "0BDEDDAE493E93BD4F4E6F8EB3BC710C1679D66444C4534D3369E54DB63A390A",
"state": "Georgia",
"stats_show": "0",
"status": "1",
"stauts": "OK",
"stripe_customer_id": "cus_O6QmTGCmEilwW6",
"uid": "3119b744-42ad-4834-bb83-b737588754ca",
"username": "ses66181+1@gmail.com",
"verify_link": "",
"zip_code": "30127",
"internal_return": 100
*/
account_type:string="";
email: string = "";
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='';
member_uid:string;
user_state:string;
city:string;
online_name:string;
pref_email:number=0;
pref_phone:number=0;
promo:number=0;
active_job_count:number =0;
session_contructed:boolean = false;
ConstructGlobalSessionData(loginResult: any) {
console.log('Hello ConstructGlobalSessionData Provider');
this.session_contructed=false;
try {
console.log(loginResult);
this.account_type = loginResult.account_type;
this.firstname = loginResult.firstname;
this.lastname = loginResult.lastname;
this.session = loginResult.session;
this.session_contructed=loginResult.balance;
this.email = loginResult.email;
this.username=loginResult.username;
this.last_login = loginResult.last_login2;
this.member_id = loginResult.member_id;
this.member_uid = loginResult.uid;
this.balance = loginResult.balance;
this.ccard=loginResult.ccard;
this.profile_pic=loginResult.profile_pic;
this.isPedningJob = loginResult.pedningjob;
this.isOfferJob = loginResult.offerjob;
this.user_state=loginResult.state;
this.city = loginResult.city;
this.online_name = loginResult.online_name;
this.pref_email= loginResult.pref_email;
this.pref_phone = loginResult.pref_phone;
this.promo=loginResult.promo;
this.active_job_count = loginResult.active_job_count;
//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;
}
DestroySessionOnLogout(){
console.log('Hello DestroySessionOnLogout Provider');
this.firstname = "";
this.lastname = "";
this.session = "INVALID";
this.session_contructed= false;
this.username="";
this.last_login = "";
this.member_id = -1;
this.member_uid = "";
this.balance = -1;
this.ccard= 0;
this.profile_pic="";
this.isPedningJob = 0;
this.isOfferJob = 0;
}
profilePicture(){
var defualtProfilePicture = "https://www.wrenchboard.com/assets/images/profile.jpg";
var profile_p = '';
if (this.profile_pic !=''){
profile_p="https://www.wrenchboard.com/smedia/LIVE/profile/"+this.profile_pic;
}
else{
profile_p = defualtProfilePicture;
}
return profile_p;
}
}