mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
upgraded Ember and Bootstrap, merged changes
This commit is contained in:
parent
b4fd42da38
commit
5dd7d9c181
114 changed files with 9814 additions and 1361 deletions
|
@ -10,17 +10,33 @@
|
|||
// https://documize.com
|
||||
|
||||
import Service, { inject as service } from '@ember/service';
|
||||
import { A } from '@ember/array';
|
||||
import ArrayProxy from '@ember/array/proxy';
|
||||
|
||||
export default Service.extend({
|
||||
sessionService: service('session'),
|
||||
ajax: service(),
|
||||
store: service(),
|
||||
|
||||
// find all matching documents.
|
||||
// find all matching documents
|
||||
find(payload) {
|
||||
return this.get('ajax').request("search", {
|
||||
method: "POST",
|
||||
data: JSON.stringify(payload),
|
||||
contentType: 'json'
|
||||
}).then((response) => {
|
||||
let results = ArrayProxy.create({
|
||||
content: A([])
|
||||
});
|
||||
|
||||
results = response.map((doc) => {
|
||||
let data = this.get('store').normalize('doc-search-result', doc);
|
||||
return this.get('store').push(data);
|
||||
});
|
||||
|
||||
return results;
|
||||
}).catch((error) => {
|
||||
return error;
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue