Add services

This commit is contained in:
Çetin
2025-01-03 12:05:07 +03:00
parent fc8f5eceee
commit d7bb01ce99
7 changed files with 46 additions and 3 deletions

View File

@@ -1,15 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable()
export class CountryService {
constructor(private http: HttpClient) { }
getCountries() {
return this.http.get<any>('assets/demo/data/countries.json')
.toPromise()
.then(res => res.data as any[])
.then(data => data);
}
}

View File

@@ -1,30 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Customer } from '../api/customer';
@Injectable()
export class CustomerService {
constructor(private http: HttpClient) { }
getCustomersSmall() {
return this.http.get<any>('assets/demo/data/customers-small.json')
.toPromise()
.then(res => res.data as Customer[])
.then(data => data);
}
getCustomersMedium() {
return this.http.get<any>('assets/demo/data/customers-medium.json')
.toPromise()
.then(res => res.data as Customer[])
.then(data => data);
}
getCustomersLarge() {
return this.http.get<any>('assets/demo/data/customers-large.json')
.toPromise()
.then(res => res.data as Customer[])
.then(data => data);
}
}

View File

@@ -1,15 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable()
export class EventService {
constructor(private http: HttpClient) { }
getEvents() {
return this.http.get<any>('assets/demo/data/scheduleevents.json')
.toPromise()
.then(res => res.data as any[])
.then(data => data);
}
}

View File

@@ -1,22 +0,0 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
@Injectable()
export class IconService {
constructor(private http: HttpClient) { }
icons!: any[];
selectedIcon: any;
apiUrl = 'assets/demo/data/icons.json';
getIcons() {
return this.http.get(this.apiUrl).pipe(map((response: any) => {
this.icons = response.icons;
return this.icons;
}));
}
}

View File

@@ -1,33 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { TreeNode } from 'primeng/api';
@Injectable()
export class NodeService {
constructor(private http: HttpClient) { }
getFiles() {
return this.http.get<any>('assets/demo/data/files.json')
.toPromise()
.then(res => res.data as TreeNode[]);
}
getLazyFiles() {
return this.http.get<any>('assets/demo/data/files-lazy.json')
.toPromise()
.then(res => res.data as TreeNode[]);
}
getFilesystem() {
return this.http.get<any>('assets/demo/data/filesystem.json')
.toPromise()
.then(res => res.data as TreeNode[]);
}
getLazyFilesystem() {
return this.http.get<any>('assets/demo/data/filesystem-lazy.json')
.toPromise()
.then(res => res.data as TreeNode[]);
}
}

View File

@@ -1,16 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Image } from '../api/image';
@Injectable()
export class PhotoService {
constructor(private http: HttpClient) { }
getImages() {
return this.http.get<any>('assets/demo/data/photos.json')
.toPromise()
.then(res => res.data as Image[])
.then(data => data);
}
}

View File

@@ -1,37 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Product } from '../api/product';
@Injectable()
export class ProductService {
constructor(private http: HttpClient) { }
getProductsSmall() {
return this.http.get<any>('assets/demo/data/products-small.json')
.toPromise()
.then(res => res.data as Product[])
.then(data => data);
}
getProducts() {
return this.http.get<any>('assets/demo/data/products.json')
.toPromise()
.then(res => res.data as Product[])
.then(data => data);
}
getProductsMixed() {
return this.http.get<any>('assets/demo/data/products-mixed.json')
.toPromise()
.then(res => res.data as Product[])
.then(data => data);
}
getProductsWithOrdersSmall() {
return this.http.get<any>('assets/demo/data/products-orders-small.json')
.toPromise()
.then(res => res.data as Product[])
.then(data => data);
}
}