|  |  | @ -1,4 +1,5 @@ | 
			
		
	
		
			
				
					|  |  |  | import { Component, OnInit } from '@angular/core' | 
			
		
	
		
			
				
					|  |  |  | import { ApisService } from '../services/apis.service' | 
			
		
	
		
			
				
					|  |  |  | import { AuthService } from '../services/auth.service' | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | @Component({ | 
			
		
	
	
		
			
				
					|  |  | @ -11,17 +12,28 @@ export class AdminComponent implements OnInit { | 
			
		
	
		
			
				
					|  |  |  |   public authCheck: boolean = false | 
			
		
	
		
			
				
					|  |  |  |   public userName: string = '' | 
			
		
	
		
			
				
					|  |  |  |   public password: string = '' | 
			
		
	
		
			
				
					|  |  |  |   public activeEditor: string = '' | 
			
		
	
		
			
				
					|  |  |  |   public exhibitions: any = [] | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   constructor(private authService: AuthService) { } | 
			
		
	
		
			
				
					|  |  |  |   public selectedExhibitions: any = [] | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   ngOnInit(): void { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     const body = { | 
			
		
	
		
			
				
					|  |  |  |       token: window.sessionStorage.getItem('authToken') | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |   constructor( | 
			
		
	
		
			
				
					|  |  |  |     private authService: AuthService, | 
			
		
	
		
			
				
					|  |  |  |     private apisService: ApisService | 
			
		
	
		
			
				
					|  |  |  |   ) { } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   ngOnInit(): void { | 
			
		
	
		
			
				
					|  |  |  |     const body = { token: window.sessionStorage.getItem('authToken') } | 
			
		
	
		
			
				
					|  |  |  |     this.authService.authCheck(body).toPromise().then((response) => { | 
			
		
	
		
			
				
					|  |  |  |       this.authCheck = response.status == 200 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       this.apisService.getPortfolio('exhibitions').toPromise().then((response) => { | 
			
		
	
		
			
				
					|  |  |  |         this.exhibitions = response.items | 
			
		
	
		
			
				
					|  |  |  |       },(error) => { | 
			
		
	
		
			
				
					|  |  |  |         console.error('getPortfolio ERROR', error) | 
			
		
	
		
			
				
					|  |  |  |       }).catch((e) => { | 
			
		
	
		
			
				
					|  |  |  |         console.error('getPortfolio CATCH', e) | 
			
		
	
		
			
				
					|  |  |  |       }) | 
			
		
	
		
			
				
					|  |  |  |     },(error) => { | 
			
		
	
		
			
				
					|  |  |  |       console.error('Auth ERROR', error) | 
			
		
	
		
			
				
					|  |  |  |     }).catch((e) => { | 
			
		
	
	
		
			
				
					|  |  | @ -31,11 +43,7 @@ export class AdminComponent implements OnInit { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   login(): void { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     const body = { | 
			
		
	
		
			
				
					|  |  |  |       usr: this.userName, | 
			
		
	
		
			
				
					|  |  |  |       pwd: this.password | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     const body = { usr: this.userName, pwd: this.password } | 
			
		
	
		
			
				
					|  |  |  |     this.authService.login(body).toPromise().then((response) => { | 
			
		
	
		
			
				
					|  |  |  |       this.authCheck = response.status == 200 | 
			
		
	
		
			
				
					|  |  |  |       if(this.authCheck) { | 
			
		
	
	
		
			
				
					|  |  | @ -46,6 +54,20 @@ export class AdminComponent implements OnInit { | 
			
		
	
		
			
				
					|  |  |  |     }).catch((e) => { | 
			
		
	
		
			
				
					|  |  |  |       console.error('Auth CATCH', e) | 
			
		
	
		
			
				
					|  |  |  |     }) | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   showEditor(section): void { | 
			
		
	
		
			
				
					|  |  |  |     this.activeEditor = section | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   exhibitionAdd(e, id): void { | 
			
		
	
		
			
				
					|  |  |  |     //e.originalTarget.value = ''
 | 
			
		
	
		
			
				
					|  |  |  |     this.selectedExhibitions.push( | 
			
		
	
		
			
				
					|  |  |  |       this.exhibitions.filter(item => item.id == id)[0] | 
			
		
	
		
			
				
					|  |  |  |     ) | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   exhibitionRemove(id): void { | 
			
		
	
		
			
				
					|  |  |  |     this.selectedExhibitions = this.selectedExhibitions.filter(item => item.id != id) | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |