Okay, it basically working. I have found a nice plugin skeleton here, GitHub - Vheissu/aurelia2-plugin-starter: A starting base for an Aurelia 2 plugin written in TypeScript, built using Rollup..
So here it is : GitHub - jvkassi/aurelia-api: A simple convenience wrapper around aurelia-fetch-client
@bigopon if you have time, please if my plugin is clean. I want to be sure to get it right
Ive just noticed that you havent modified package.json with your info.
Additionally you might want Config to implement IConfig and not having the Interface extend a class aurelia-api/config.ts at master · jvkassi/aurelia-api · GitHub
You might also want to allow passing in a HttpClient as param instead of creating always a new instance. aurelia-api/config.ts at master · jvkassi/aurelia-api · GitHub
The reason could be that there are already existing instances the User might want to reuse. Or to simplify unit testing by allowing to pass in mocked clients
Hello,
Thanks guy ! You guys are my heroes
Okay i have fixed implement and updated package.json
I am not sure how to pass httpclient as a param.
Endpoint are registered at startup
.register(
AureliaAPIConfiguration.customize((config) => {
// config.
config.defaultBaseUrl = '/api';
config.registerEndpoint('api', '/mypath');
return config;
})
)
Next on my list is GitHub - jvkassi/aurelia-view-manager: A view manager for aurelia plugins. Add support for overriding views, and multiple frameworks.
How do port this class
aurelia-view-manager/resolved-view-strategy.js at master · jvkassi/aurelia-view-manager · GitHub
I couldnât find the v2 version of this âviewStrategyâ
Perhaps this helps vNext - The Aurelia Discourse
yeah, iâm digging.
I didnât find anything yet that talk about this viewStrategy in v2.
This is seems to be very specific. Maybe this way of doing things is obselete in v2
@mib4fun when I add your aurelia-api module via npm add -S "aurelia-api@github:jvkassi/aurelia-api"
I am getting a message that there are no type definitions.
Iâm trying to replace this:
import {Endpoint, Rest} from 'aurelia-api';
import {AuthService} from 'aurelia-authentication';
import {inject} from 'aurelia-framework';
@inject(Endpoint.of('auth'), Endpoint.of('api'), AuthService)
export class AppState {
authService?: AuthService;
constructor(_authHttp: Rest, _apiHttp: Rest, authService: AuthService) {
this.authService = authService;
}
}
Hello,
wow someone using my package
I converted this package from plain JS to typescript.
I still have to add types definitions.
If you can make a pull request that would be fantastic !