35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { providerData } from '../../src/models/temp.model';
|
|
import { ReplaySubject } from 'rxjs';
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class DataProviderService {
|
|
public cache = new ReplaySubject(1);
|
|
constructor(private http: HttpClient ) {
|
|
this.updateData();
|
|
|
|
}
|
|
public updateData(){
|
|
this.http.get(this.url+'/alldata').subscribe(data=>this.cache.next(data));
|
|
}
|
|
// allData(){
|
|
// return this.http.get('https://bc50-104-199-132-26.ngrok.io/alldata');
|
|
// }
|
|
public url = 'http://6447-35-186-184-86.ngrok.io'
|
|
insert(dbname: String,colname: String,web: String,cat: String){
|
|
//return this.http.get<providerData>("http://localhost:/insert?dbname="+dbname+"&collectionname="+colname+"&web="+web+"&cat="+cat);
|
|
return this.http.get<providerData>(this.url+"/insert?dbname=data&collectionname=testdata&web=com.burbn.instagram&cat=photos");
|
|
}
|
|
|
|
public getData(listData: any,lineChart: any) {
|
|
return this.cache.asObservable();
|
|
}
|
|
update(data: any) {
|
|
return data;
|
|
}
|
|
|
|
}
|
|
|