family clean up
This commit is contained in:
@@ -1,64 +1,117 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {SessionDataProviderService} from "./session-data-provider.service";
|
||||
import {WrenchService} from "../services/wrench.service";
|
||||
import {Router} from "@angular/router";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { SessionDataProviderService } from "./session-data-provider.service";
|
||||
import { WrenchService } from "../services/wrench.service";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: "root",
|
||||
})
|
||||
export class BannersDataService {
|
||||
homebannerCount:number=0;
|
||||
bannerResult:any;
|
||||
homebannerCount: number = 0;
|
||||
bannerResult: any;
|
||||
bannerData: [];
|
||||
|
||||
constructor(
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService,
|
||||
private route:Router
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService,
|
||||
private route: Router
|
||||
) {}
|
||||
|
||||
usrData: {
|
||||
action:number,
|
||||
member_id: number,
|
||||
uid: string,
|
||||
sessionid: string,
|
||||
limit: 30,
|
||||
offset: 0
|
||||
};
|
||||
action: number;
|
||||
member_id: number;
|
||||
uid: string;
|
||||
sessionid: string;
|
||||
limit: 30;
|
||||
offset: 0;
|
||||
};
|
||||
|
||||
async getBannersData(){
|
||||
if (this.sessionDataProviderService.account_type=='FAMILY'){
|
||||
await this.getFamilyBannersData();
|
||||
}
|
||||
else{
|
||||
await this.getHomeBannersData();
|
||||
}
|
||||
}
|
||||
async getHomeBannersData() {
|
||||
this.usrData = {
|
||||
action:11200,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session,
|
||||
limit: 30,
|
||||
offset: 0
|
||||
action: 11200,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session,
|
||||
limit: 30,
|
||||
offset: 0,
|
||||
};
|
||||
|
||||
this.wrenchService.getHomeBanners(this.usrData).subscribe(
|
||||
bannerResult => {
|
||||
this.bannerResult = bannerResult;
|
||||
this.wrenchService
|
||||
.getHomeBanners(this.usrData)
|
||||
.subscribe((bannerResult) => {
|
||||
this.bannerResult = bannerResult;
|
||||
|
||||
if ( this.bannerResult == undefined || this.bannerResult.internal_return == -9999){
|
||||
// force logout
|
||||
console.log("FORCE BANNER LOGOUT BANNERS RETURN->", this.bannerResult);
|
||||
this.sessionDataProviderService.DestroySessionOnLogout();
|
||||
this.route.navigate(['logout']);
|
||||
}
|
||||
|
||||
console.log("BANNERS RETURN->", this.bannerResult);
|
||||
this.bannerData = this.bannerResult.result_list;
|
||||
if ( this.bannerResult.home_dash_type != ''){
|
||||
// debugger;
|
||||
this.sessionDataProviderService.home_dash_type = this.bannerResult.home_dash_type;
|
||||
}
|
||||
this.homebannerCount = this.bannerData?.length;
|
||||
if (
|
||||
this.bannerResult == undefined ||
|
||||
this.bannerResult.internal_return == -9999
|
||||
) {
|
||||
// force logout
|
||||
console.log(
|
||||
"FORCE BANNER LOGOUT BANNERS RETURN->",
|
||||
this.bannerResult
|
||||
);
|
||||
this.sessionDataProviderService.DestroySessionOnLogout();
|
||||
this.route.navigate(["logout"]);
|
||||
}
|
||||
);
|
||||
|
||||
console.log("BANNERS RETURN->", this.bannerResult);
|
||||
this.bannerData = this.bannerResult.result_list;
|
||||
if (this.bannerResult.home_dash_type != "") {
|
||||
// debugger;
|
||||
this.sessionDataProviderService.home_dash_type =
|
||||
this.bannerResult.home_dash_type;
|
||||
}
|
||||
this.homebannerCount = this.bannerData?.length;
|
||||
});
|
||||
}
|
||||
|
||||
familyBannerCount: number = 0;
|
||||
familyBannerResult: any;
|
||||
familyBannerData: [];
|
||||
async getFamilyBannersData() {
|
||||
this.usrData = {
|
||||
action: 11200,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session,
|
||||
limit: 30,
|
||||
offset: 0,
|
||||
};
|
||||
|
||||
this.wrenchService
|
||||
.getFamilyBanners(this.usrData)
|
||||
.subscribe((familyBannerResult) => {
|
||||
this.familyBannerResult = familyBannerResult;
|
||||
|
||||
if (
|
||||
this.familyBannerResult == undefined ||
|
||||
this.familyBannerResult.internal_return == -9999
|
||||
) {
|
||||
// force logout
|
||||
console.log(
|
||||
"FORCE BANNER LOGOUT BANNERS RETURN->",
|
||||
this.familyBannerResult
|
||||
);
|
||||
this.sessionDataProviderService.DestroySessionOnLogout();
|
||||
this.route.navigate(["logout"]);
|
||||
}
|
||||
|
||||
console.log("BANNERS RETURN->", this.familyBannerResult);
|
||||
this.familyBannerData = this.familyBannerResult.result_list;
|
||||
if (this.bannerResult.home_dash_type != "") {
|
||||
// debugger;
|
||||
// this.sessionDataProviderService.home_dash_type =
|
||||
// this.bannerResult.home_dash_type;
|
||||
}
|
||||
this.familyBannerCount = this.familyBannerData?.length;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user