Allow configuring/using FetchClient
Closed this issue · 2 comments
mreiche commented
I have already a configured FetchClient for CORS and CSRF-Protection.
Aurelia-ORM should use this FetchClient instead of creating a new one.
RWOverdijk commented
You can set the client in api. Get the endpoint and set .client to your client.
mreiche commented
Works
import {ApiClient} from './api-client';
export function configure(config) {
config.plugin('aurelia-api', aureliaApi => {
const apiClient:ApiClient = config.aurelia.container.get(ApiClient);
aureliaApi
.registerEndpoint('myty', '')
.setDefaultEndpoint('myty');
const mytyEndpoint = aureliaApi.getEndpoint('myty');
apiClient.fetchClient.baseUrl = 'http://www.example.com/api'
mytyEndpoint.client = apiClient.fetchClient;
});
}