Initial application generated by JHipster-5.8.2
This commit is contained in:
18
src/main/webapp/app/shared/util/request-util.ts
Normal file
18
src/main/webapp/app/shared/util/request-util.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
|
||||
export const createRequestOption = (req?: any): HttpParams => {
|
||||
let options: HttpParams = new HttpParams();
|
||||
if (req) {
|
||||
Object.keys(req).forEach(key => {
|
||||
if (key !== 'sort') {
|
||||
options = options.set(key, req[key]);
|
||||
}
|
||||
});
|
||||
if (req.sort) {
|
||||
req.sort.forEach(val => {
|
||||
options = options.append('sort', val);
|
||||
});
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
Reference in New Issue
Block a user