feat(client): POST client address && fix(client): fixed sorting and pagination in view clients (#115)
* feat(client): POST client address && fix(client): fixed sorting and pagination in view clients
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http, Headers, Response } from '@angular/http';
|
||||
import { Http, Headers, Response, RequestOptions, URLSearchParams } from '@angular/http';
|
||||
/* import { HttpHeaders, HttpClient } from '@angular/common/http';
|
||||
*/
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -141,4 +141,45 @@ export class ClientsService {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getClientAddressTemplate() {
|
||||
const headers = new Headers(); // tslint:disable-line
|
||||
this.createAuthorizationHeader(headers);
|
||||
return this.http.get
|
||||
('https://demo.openmf.org/fineract-provider/api/v1/client/'
|
||||
+ 'addresses/template?tenantIdentifier=default',
|
||||
{headers: headers})
|
||||
.pipe(
|
||||
map(
|
||||
(response: Response) => { // tslint:disable-line
|
||||
response = response.json();
|
||||
return response;
|
||||
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
postClientAddress (clientId: number, body: any, type: any) {
|
||||
const headers = new Headers(); // tslint:disable-line
|
||||
const params = new URLSearchParams(); // tslint:disable-line
|
||||
params.set('type', type);
|
||||
this.createAuthorizationHeader(headers);
|
||||
body = JSON.stringify(body);
|
||||
const options = new RequestOptions({ // tslint:disable-line
|
||||
headers: headers,
|
||||
params: params,
|
||||
});
|
||||
return this.http.post
|
||||
('https://demo.openmf.org/fineract-provider/api/v1/client/' + clientId
|
||||
+ '/addresses?' + '&tenantIdentifier=default&pretty=true', body ,
|
||||
options)
|
||||
.pipe(
|
||||
map(
|
||||
(response: Response) => { // tslint:disable-line
|
||||
response.json();
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user