fs-webcomponents / fs-elements

Collection of FamilySearch Polymer elements.
https://www.webcomponents.org/collection/fs-webcomponents/fs-elements
MIT License
4 stars 0 forks source link

Standard AJAX handling #15

Closed justincy closed 7 years ago

justincy commented 7 years ago

Most components need to load data from the API. We already have fs-behavior which helps with this by making it easy to access the SDK client. Perhaps we should augment to help with other common tasks such as tracking loading status.

Perhaps we need our own version of iron-ajax. Then, instead of using a behavior or mixin which is all or nothing, components can choose, via data binding and other integration points, how much of the behavior they get. It would replace most instances of fs-client.

fs-ajax or fs-request?

justincy commented 7 years ago

This would also help standardize response and error handling.

justincy commented 7 years ago

iron-ajax supports multiple outstanding AJAX requests. I don't believe we need to allow multiple requests in that we support a component fetch two different entities, but we do need to support autocomplete for fs-date and fs-place which can include many requests fired in close succession.

justincy commented 7 years ago

Features:

Example:

<fs-request url="{{computeUrl(personId)}}" on-response="{{handleResponse}}"></fs-request>

computeUrl(personId) {
    return `/platform/tree/persons/${personId}`;
}
justincy commented 7 years ago

https://github.com/fs-webcomponents/fs-request