Skip to content
Snippets Groups Projects
Commit d9576dbc authored by bhm15's avatar bhm15
Browse files

SCRUM#14 Update data api service

parent 8a075cd7
No related branches found
No related tags found
1 merge request!5SCRUM#14 Update data api service
......@@ -9,7 +9,7 @@ declare var da: any;
export class DataApiService {
private domainBackEnd = "http://localhost:3000"
//Agent
public getAgentById(id,agents){
var hospital = null;
for(var i in agents){
......@@ -28,7 +28,44 @@ export class DataApiService {
callback(result);
});
}
//
//Uses
/*
config format:
{
"type": string
"y1": int, "y2": int, "m1": int,
"m2": int, "d1": int, "d2": int
}
type field must be 'day' or 'month' and its default value is 'day'
1 and 2 represents the intervale between dates (from 1 to 2)
d = day; m = month; y = year;
To use day, its necessary set month, and to use month its
necessary to use year
If this fields are invalid or omited, all entries will be returned
*/
public loadData(callback, config){
var type = "agentusesday";
if(config.type == "month") type = "agentusesmonth";
$.getJSON(this.domainBackEnd+"/api/data/"+type, config, function(result){
callback(result);
});
}
//
//Geolocation
private cacheStates = null;
public loadStates(callback){
var da = this;
......@@ -59,7 +96,7 @@ export class DataApiService {
callback(x);
});
}
//
constructor() { }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment