Skip to content

Commit

Permalink
Task #58726: Fix for wrong breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
christyfernandes committed Jul 1, 2022
1 parent 5221604 commit bf34a1a
Showing 1 changed file with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy } from '@angular/core'
import { Router } from '@angular/router'
import { ActivatedRoute } from '@angular/router'
// import { NsWidgetResolver } from '@sunbird-cb/resolver'
// import { ILeftMenu } from '@sunbird-cb/collection'
import { ValueService } from '@sunbird-cb/utils'
Expand All @@ -21,7 +21,11 @@ export class HomeComponent implements OnInit, OnDestroy {
mydept!: string
role: any
dept!: string
constructor(private valueSvc: ValueService, private router: Router) {
constructor(
private valueSvc: ValueService,
// private router: Router,
private route: ActivatedRoute,
) {
// this.router.events.subscribe((event: Event) => {
// if (event instanceof NavigationEnd) {
// this.bindUrl(event.urlAfterRedirects.replace('/app/roles-access/', ''))
Expand All @@ -32,6 +36,10 @@ export class HomeComponent implements OnInit, OnDestroy {

// }
// })
this.route.queryParams.subscribe(params => {
this.dept = params['currentDept']
this.mydept = params['depatName']
})
}

ngOnInit() {
Expand All @@ -41,28 +49,28 @@ export class HomeComponent implements OnInit, OnDestroy {
this.screenSizeIsLtMedium = isLtMedium
})

const url = this.router.url.split('/')
const dept = this.router.url.split('=')
if (dept[1]) {
const nxt = dept[1].split(';')
const re = /\%20/gi
if (nxt[0] === 'true' || nxt[0].includes('%')) {
this.dept = url[3].replace(re, ' ')
} else {
this.dept = nxt[0].replace(re, ' ')
}
if (dept[3]) {
const depturl = dept[3].replace(re, ' ')
const depturl1 = decodeURI(depturl).replace(/%26/g, '&')
this.mydept = depturl1
} else {
this.mydept = 'Basic Information'
}
if (this.dept.length > 6) {
this.dept = 'CBP Providers'
}
this.role = url[url.length - 2]
}
// const url = this.router.url.split('/')
// const dept = this.router.url.split('=')
// if (dept[1]) {
// const nxt = dept[1].split(';')
// const re = /\%20/gi
// if (nxt[0] === 'true' || nxt[0].includes('%')) {
// this.dept = url[3].replace(re, ' ')
// } else {
// this.dept = nxt[0].replace(re, ' ')
// }
// if (dept[3]) {
// const depturl = dept[3].replace(re, ' ')
// const depturl1 = decodeURI(depturl).replace(/%26/g, '&')
// this.mydept = depturl1
// } else {
// this.mydept = 'Basic Information'
// }
// if (this.dept.length > 6) {
// this.dept = 'CBP Providers'
// }
// this.role = url[url.length - 2]
// }
}

ngOnDestroy() {
Expand Down

0 comments on commit bf34a1a

Please sign in to comment.