maykinmedia / consumerjs Goto Github PK
View Code? Open in Web Editor NEWConsumerjs simplifies REST with an ORM like approach. Built on top of Axios.
License: MIT License
Consumerjs simplifies REST with an ORM like approach. Built on top of Axios.
License: MIT License
To be able to make CORS-requests, we should be able to pass the withCredentials: true
to axios-requests. This is currently not possible, because consumerjs/axios-http-client
cannot be imported to subclass it. This should probably be an option on the abstract-consumer.
Use case:
http://localhost:8000
http://localhost
http://localhost
Javascript to http://localhost:8000
and observe that the cookies are not sent.__consumer__
property on consumer object causes circular structure error when manually serializing it (for example when saving data to local storage).
Error:
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'CourseConsumer'
| property 'client' -> object with constructor 'e'
--- property 'consumer' closes the circle
In some environments it's useful to cancel requests. ConsumerJS should support these scenarios.
In my use-case I'm using consumerjs to fetch search results based on a number of filters, in a React application. I already de-bounce events, but it happens that a request fires and another search-query is performed before the previous request finishes (thumbnailing on my dev-machine is slow ;) ).
This messes up my component, as the earlier request now overwrites the results from the current search because of the long request time (10s vs 2s for example).
To combat this, I want to be able to cancel the old request. Axios supports this, so this interface should maybe be exposed in ConsumerJS too? See https://github.com/axios/axios#cancellation
ConsumerJS expects JSON, while HTTP 204 returns an empty body. This is the case for DELETE
requests.
Currently, the consumers (this).client is always an instance of the Aurelia http client. This needs to be abstracted so different clients can be used and configured (e.g. a fetch client).
When serializing an Array, data is malformed:
['a', 'b'] becomes {'0': 'a', '1': 'b'}.
getChangedFields crashes on some objects for some reason (possibly due to undefined in keys?) causing CrudConsumerObject.update() to fail.
This needs te be thought out more clearly, probably would require lists to return a custom type that extends the Array prototype and holds page state related information.
The implementation needs to be generic and not specific for any framework like Django REST. Maybe we should allow something like a pagination class in consumers...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.