|
|
|
import { Component, OnInit } from '@angular/core'
|
|
|
|
import { Router, NavigationEnd } from '@angular/router'
|
|
|
|
import { ApisService } from '../services/apis.service'
|
|
|
|
import { environment } from '../../environments/environment'
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-portfolio',
|
|
|
|
templateUrl: './portfolio.component.html',
|
|
|
|
styleUrls: ['./portfolio.component.scss']
|
|
|
|
})
|
|
|
|
export class PortfolioComponent implements OnInit {
|
|
|
|
|
|
|
|
public basePath = `${environment.BASE_PATH}`
|
|
|
|
|
|
|
|
public portfolioItems: any = []
|
|
|
|
public section: string = ''
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private apisService: ApisService,
|
|
|
|
private router: Router)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.section = this.router.url.split('/')[1]
|
|
|
|
|
|
|
|
this.apisService.getPortfolio(this.section).toPromise().then((response) => {
|
|
|
|
this.portfolioItems = response.items
|
|
|
|
},(error) => {
|
|
|
|
console.error('getPortfolio ERROR', error)
|
|
|
|
}).catch((e) => {
|
|
|
|
console.error('getPortfolio CATCH', e)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
showDetails(id): void {
|
|
|
|
const section = this.section == 'exhibitions' ? 'exhibitions' : 'works'
|
|
|
|
this.router.navigate([`/detail/${section}/${id}`])
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|