-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
Currently requests in a model or store are done via src/request.js. This is kind of a global module. It doesn't offer enough flexibility and makes unit testing harder because it sets variables like baseUrl and csrfToken in the global module.
We could refactor this to a Request class. The user can initialize a Request class in it's own code (only needs to be done once), like this:
import { Request as BRequest } from 'mobx-binder';
class Request extends BRequest {
baseUrl = 'http://localhost:8080/api/';
csrfToken = 'xxx';
get(...args) {
// do custom stuff
super().get(..args);
}
}If you want to make requests with a model or store, you need to pass in an initialized Request class. Otherwise it will give a clear error message that you need to pass such a class.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels