Initial commit

This commit is contained in:
jar3b
2016-04-25 18:31:43 +03:00
parent 53d15517f7
commit 9718584ced
28 changed files with 262 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'http://api.fias.hellotan.ru'
});

View File

@@ -0,0 +1,18 @@
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
query: function(store, type, query) {
var url = this.get('host')+'/find/'+query.text;
Ember.Logger.log('url:', url);
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});