You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

import { Injectable } from '@angular/core'
import { HttpClient, HttpHeaders, HttpParams, HttpRequest } from '@angular/common/http'
import { Observable, Subject, throwError } from 'rxjs'
import { catchError } from 'rxjs/operators'
import { BaseService } from './base-service'
import { environment } from '../../environments/environment'
@Injectable({
providedIn: 'root'
})
export class ApisService extends BaseService {
private restApi = `${environment.API_URL}`
constructor(private http: HttpClient) {
super()
}
getPortfolio(section, randon = false): Observable<any> {
let urlApi = `${this.restApi}?query=${section}&random=${randon}`
return this.http.get<any>(urlApi).pipe(
catchError(this.handleError)
)
}
getDetails(section, id): Observable<any> {
let urlApi = `${this.restApi}?query=detail&type=${section}&id=${id}`
5 years ago
return this.http.get<any>(urlApi).pipe(
catchError(this.handleError)
)
}
// ADMIN SERVICES
uploadImage(body): Observable<any> {
let urlApi = `${this.restApi}upload.php`
return this.http.post<any>(urlApi, body).pipe(
catchError(this.handleError)
)
}
removeImage(body): Observable<any> {
let urlApi = `${this.restApi}remove.php`
return this.http.post<any>(urlApi, JSON.stringify(body)).pipe(
catchError(this.handleError)
)
}
saveWork(body): Observable<any> {
let urlApi = `${this.restApi}work.php?act=save`
return this.http.post<any>(urlApi, JSON.stringify(body)).pipe(
catchError(this.handleError)
)
}
5 years ago
deleteWork(body): Observable<any> {
let urlApi = `${this.restApi}work.php?act=delete`
return this.http.post<any>(urlApi, JSON.stringify(body)).pipe(
catchError(this.handleError)
)
}
saveExhibition(body): Observable<any> {
let urlApi = `${this.restApi}exhibition.php?act=save`
return this.http.post<any>(urlApi, JSON.stringify(body)).pipe(
catchError(this.handleError)
)
}
deleteExhibition(body): Observable<any> {
let urlApi = `${this.restApi}exhibition.php?act=delete`
return this.http.post<any>(urlApi, JSON.stringify(body)).pipe(
catchError(this.handleError)
)
}
}