Skip to content

Commit

Permalink
Merge pull request #222 from sunbird-cb/kar-202-logout-issue
Browse files Browse the repository at this point in the history
Kar 202 logout issue
  • Loading branch information
vishnubansaltarento authored May 24, 2024
2 parents 44bc196 + cf8aac4 commit 78ba3f1
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@sunbird-cb/collection": "^1.0.34",
"@sunbird-cb/rain-dashboards": "^0.3.9",
"@sunbird-cb/resolver": "^1.0.0",
"@sunbird-cb/utils": "^1.0.13",
"@sunbird-cb/utils": "^1.0.17",
"@types/file-saver": "^2.0.1",
"@types/lodash": "4.14.172",
"@types/video.js": "7.2.12",
Expand Down
6 changes: 3 additions & 3 deletions project/ws/app/src/lib/routes/home/home.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
ScrollspyLeftMenuModule,
} from '@sunbird-cb/collection'
// TO-DO need to enable for image crop
//import { ImageCropModule } from './routes/image-crop/image-crop.module'
// import { ImageCropModule } from './routes/image-crop/image-crop.module'
import { AboutComponent } from './routes/about/about.component'
import { RolesAccessComponent } from './routes/roles-access/roles-access.component'
import { DirectoryViewComponent } from './routes/directory/directroy.component'
Expand Down Expand Up @@ -160,7 +160,7 @@ import { AddThumbnailComponent } from './routes/add-thumbnail/add-thumbnail.comp
WidgetResolverModule,
UserAutocompleteModule,
// TO-DO need to enable for image crop
//ImageCropModule,
// ImageCropModule,
UIAdminTableModule,
UIORGTableModule,
MatTableModule,
Expand All @@ -170,7 +170,7 @@ import { AddThumbnailComponent } from './routes/add-thumbnail/add-thumbnail.comp
PipePublicURLModule,
ScrollspyLeftMenuModule,
// TO-DO need to enable for image crop
//ImageCropModule,
// ImageCropModule,
NgMultiSelectDropDownModule.forRoot(),
],
entryComponents: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class PipePublicURL implements PipeTransform {
const finalURL = `${environment.contentHost}${mainUrl}`
return value ? finalURL : ''

} else {
} {
const mainUrl = value && value.split('/content').pop() || ''
const finalURL = `${environment.contentHost}/${environment.contentBucket}/content${mainUrl}`
return value ? finalURL : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ export class AddThumbnailComponent implements OnInit {
createdBy,
compatibilityLevel: {
min: sectorConstants.minCompatibilityLevel,
max: sectorConstants.maxCompatibilityLevel
max: sectorConstants.maxCompatibilityLevel,
},
contentType: ['Asset'],
mediaType: ['image'],
status: ['Draft'],
resourceCategory: ['sector']
resourceCategory: ['sector'],
},
query: this.queryFilter,
sort_by: { lastUpdatedOn: 'desc' },
Expand All @@ -144,7 +144,7 @@ export class AddThumbnailComponent implements OnInit {
this.totalContent = data && data.result.response ? data.result.response.totalHits : sectorConstants.zero
this.fetchError = false
},
error => {
error => {
// tslint:disable-next-line: no-console
console.log(error)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class ImageCropComponent implements OnInit {
isXSmall = false
isThumbnail = true


constructor(
private dialogRef: MatDialogRef<ImageCropComponent>,
private configSvc: ConfigurationsService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AddSectorComponent implements OnInit {
this.router.navigate([`/app/home/sectors`])
}
this.isLoading = false
}, eResp => {
}, eResp => {
if (eResp && eResp.error && eResp.error.responseCode === 'BAD_REQUEST') {
this.snackBar.open(eResp.error.params.errmsg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class EditSectorComponent implements OnInit {
})
}
}
}, error => {
}, error => {
this.snackBar.open(error, 'X', { duration: sectorConstants.duration })
})
}
Expand All @@ -91,8 +91,8 @@ export class EditSectorComponent implements OnInit {

// Add sub sectors
onSubSectorSubmit() {
let children: any = [...this.sectorDetails.children]
let requestBody = {
const children: any = [...this.sectorDetails.children]
const requestBody = {
request: {
identifier: this.sectorDetails.identifier,
subsectors: children,
Expand All @@ -108,7 +108,7 @@ export class EditSectorComponent implements OnInit {
this.router.navigate([`/app/home/sectors`])
}
this.loading = false
}, eResp => {
}, eResp => {
if (eResp && eResp.error && eResp.error.responseCode === 'BAD_REQUEST') {
this.snackBar.open(eResp.error.params.errmsg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export const sectorConstants = {
maxCompatibilityLevel: 2,
zero: 0,
pageSize: 20,
pageOptions: [20, 30, 40]
}
pageOptions: [20, 30, 40],
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SectorsComponent implements OnInit {
})
}
this.isLoading = false
}, error => {
}, error => {
this.isLoading = false
// tslint:disable-next-line: no-console
console.log(error)
Expand Down
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { PublicLogoutComponent } from './routes/public/public-logout/public-logo
import { TncComponent } from './routes/tnc/tnc.component'
import { TncAppResolverService } from './services/tnc-app-resolver.service'
import { TncPublicResolverService } from './services/tnc-public-resolver.service'
import { PublicHomeComponent } from './routes/public/public-home/public-home.component'
// import { AppTocResolverService } from '@ws/app/src/lib/routes/app-toc/resolvers/app-toc-resolver.service'

// 💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥
Expand Down Expand Up @@ -280,6 +281,10 @@ const routes: Routes = [
path: 'public/logout',
component: PublicLogoutComponent,
},
{
path: 'public/home',
component: PublicHomeComponent,
},
{
path: 'public/mobile-app',
component: MobileAppHomeComponent,
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { TncPublicResolverService } from './services/tnc-public-resolver.service
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { environment } from '../environments/environment'
import { PublicLogoutModule } from './routes/public/public-logout/public-logout.module'
import { PublicHomeComponent } from './routes/public/public-home/public-home.component'
// import { ServiceWorkerModule } from '@angular/service-worker'
// import { environment } from '../environments/environment'

Expand Down Expand Up @@ -97,6 +98,7 @@ const getBaseHref = (platformLocation: PlatformLocation): string => {
DialogConfirmComponent,
LoginRootComponent,
LoginRootDirective,
PublicHomeComponent,
],
imports: [
FormsModule,
Expand Down
Empty file.
Empty file.
25 changes: 25 additions & 0 deletions src/app/routes/public/public-home/public-home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'

import { PublicHomeComponent } from './public-home.component'

describe('PublicHomeComponent', () => {
let component: PublicHomeComponent
let fixture: ComponentFixture<PublicHomeComponent>

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PublicHomeComponent],
})
.compileComponents()
}))

beforeEach(() => {
fixture = TestBed.createComponent(PublicHomeComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy()
})
})
20 changes: 20 additions & 0 deletions src/app/routes/public/public-home/public-home.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
@Component({
selector: 'ws-public-home',
templateUrl: './public-home.component.html',
styleUrls: ['./public-home.component.scss'],
})
export class PublicHomeComponent implements OnInit {

constructor(private router: Router) { }

ngOnInit() {
this.router.events.subscribe(() => {
if (window.location.href.includes('public/home')) {
window.location.href = '/public/logout'
}
})
}

}
1 change: 1 addition & 0 deletions src/app/services/init.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ export class InitService {
dealerCode: null,
isManager: false,
}
localStorage.setItem('login', 'true')
} else {
this.authSvc.force_logout()
}
Expand Down

0 comments on commit 78ba3f1

Please sign in to comment.