@funxtion/ng-funxtion-api-client v1.5.3
Funxtion API Client for Angular
This is an Angular library for communication with the Funxtion API v2.
Installation
npm i @funxtion/ng-funxtion-api-client
Dependencies
OAuth 2
[Manfred Steyer's Angular OAuth 2](https://manfredsteyer.github.io/angular-oauth2-oidc/docs/)
npm i angular-oauth2-oidc
This service can be accessed through FunxtionApiClientService.oauth
.
JSON API
[Ghidoz' Angular 2 JSON API](https://github.com/ghidoz/angular2-jsonapi)
npm i angular2-jsonapi
This service can be accessed through FunxtionApiClientService.datastore
.
Refreshing of tokens happens automatically in the OauthService
for logged in users. This service also passes the tokens to the DatastoreService
.
Environment
Implement the EnvironmentVariables
interface on your environment file. Do this for both your local and production environment files.
Usage
AppModule
import { NgModule } from '@angular/core';
import { FunxtionApiClientModule, FunxtionApiClientService } from '@funxtion/ng-funxtion-api-client';
@NgModule({
imports: [FunxtionApiClientModule],
providers: [FunxtionApiClientService]
})
export class AppModule {}
AppComponent
import { FunxtionApiClientService } from '@funxtion/ng-funxtion-api-client';
import { environment } from '../environments/environment';
export class AppComponent {
constructor(private funxtion: FunxtionApiClientService) {
this.funxtion.setup(environment).then(() => {
// optionally listen for API errors
this.funxtion.datastore.error$.subscribe((error) => {
// handle the error(s)
});
// other logic for the app
});
}
}
Services
In addition to the third party services mentioned in the [dependencies section](#dependencies), the library contains the following custom services:
UserService
Use this service for managing user actions.
Properties
- data (User model)
- password (can be used for form model binding, gets erased after login and register)
Methods
- login
- logout
- register
- getUser
ClientService
Use this service for managing client actions.
Properties
- data (Client model)
Methods
- getClient
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago