From b7e946f80a4b74ad8b9a652454d9a56ce56dd094 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 28 Nov 2023 12:06:41 -0500 Subject: [PATCH] log out forced --- src/app/store/banners-data.service.ts | 53 ++++++++++++++++------- src/app/store/interval-refresh.service.ts | 3 +- src/app/store/tasks-data.service.ts | 6 +-- src/app/store/usersoffers-data.service.ts | 6 +-- 4 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/app/store/banners-data.service.ts b/src/app/store/banners-data.service.ts index 08aafc6..a857f49 100644 --- a/src/app/store/banners-data.service.ts +++ b/src/app/store/banners-data.service.ts @@ -1,35 +1,58 @@ 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' }) export class BannersDataService { homebannerCount:number=0; - constructor( public sessionDataProviderService: SessionDataProviderService, - private wrenchService: WrenchService) { } bannerResult:any; bannerData: []; + + constructor( + 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(){ - 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.getHomeBanners(this.usrData).subscribe( + 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.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; - this.homebannerCount = this.bannerData.length; - // debugger; - console.log("BANNERS RETURN DATA->", this.bannerData); - // this.blogDataService.setBlogData(this.blogResult.blog_data); + this.homebannerCount = this.bannerData?.length; } ); } diff --git a/src/app/store/interval-refresh.service.ts b/src/app/store/interval-refresh.service.ts index 010c6b8..8a857d1 100644 --- a/src/app/store/interval-refresh.service.ts +++ b/src/app/store/interval-refresh.service.ts @@ -26,10 +26,9 @@ export class IntervalRefreshService { clearInterval(interval); return; } - console.log("Interval Function ",this.sessionDataProviderService.session ); + this.bannersDataService.getBannersData(); this.marketDataService.getJobsData(); this.tasksDataService.getJobsData(); - this.bannersDataService.getBannersData(); this.usersoffersDataService.getMyOffersData(); }, this.sessionDataProviderService.refresh*2); diff --git a/src/app/store/tasks-data.service.ts b/src/app/store/tasks-data.service.ts index 6d3714e..f6ef4b6 100644 --- a/src/app/store/tasks-data.service.ts +++ b/src/app/store/tasks-data.service.ts @@ -64,9 +64,9 @@ export class TasksDataService { this.jobsData = AllResult.filter((item) => item.status_description == 'ACTIVE') this.jobsPastDueData =AllResult.filter((item) => item.status_description == 'PASTDUE') this.jobsInReviewData =AllResult.filter((item) => item.status_description == 'REVIEW') - this.active_job_count = this.jobsData.length; - this.review_job_count = this.jobsInReviewData.length; - this.pastdue_job_count = this.jobsPastDueData.length; + this.active_job_count = this.jobsData?.length; + this.review_job_count = this.jobsInReviewData?.length; + this.pastdue_job_count = this.jobsPastDueData?.length; // debugger; } ); diff --git a/src/app/store/usersoffers-data.service.ts b/src/app/store/usersoffers-data.service.ts index 5cc0409..78a0d3d 100644 --- a/src/app/store/usersoffers-data.service.ts +++ b/src/app/store/usersoffers-data.service.ts @@ -37,10 +37,10 @@ export class UsersoffersDataService { myOffersTotalData => { this.myOffersTotalData = myOffersTotalData; this.session_image_server = this.myOffersTotalData.session_image_server; - console.log("myOffersTotalData RETURN->", this.myOffersTotalData); + //console.log("myOffersTotalData RETURN->", this.myOffersTotalData); this.myOffersData = this.myOffersTotalData.result_list; - console.log("myOffersData RETURN DATA->", this.myOffersData); - this.total_offers = this.myOffersData.length; + //console.log("myOffersData RETURN DATA->", this.myOffersData); + this.total_offers = this.myOffersData?.length; } );