Use ngx-restangular to handle account API.
This commit is contained in:
@ -9,13 +9,28 @@ import { BrowserModule } from '@angular/platform-browser';
|
||||
import { UpgradeModule } from '@angular/upgrade/static';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { RestangularModule } from 'ngx-restangular';
|
||||
|
||||
import { AccountModule } from './accounts/account.module';
|
||||
import { ApiBaseURL } from './app.config';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
UpgradeModule,
|
||||
AccountModule
|
||||
AccountModule,
|
||||
RestangularModule.forRoot((RestangularProvider) => {
|
||||
RestangularProvider.setBaseUrl(ApiBaseURL);
|
||||
|
||||
// Inject JSON in error instead the full response object.
|
||||
RestangularProvider.setErrorInterceptor(
|
||||
function(response, subject, responseHandler) {
|
||||
// TODO Alexis Lahouze 2017-07-16 Handle 401 error.
|
||||
subject.error(response.json());
|
||||
return false;
|
||||
}
|
||||
);
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user