Voucher Post and Delete working!!
Also figured out why a lot of exceptions are generating 500 errors. Those errors are again caught by the general exception catcher in the end and re thrown. Need to fix this.
This commit is contained in:
1 parent
0177921e84
commit
8ae67863eb
6 files changed
+104
-111
No files matched your search
@@ -24,7 +24,7 @@ export class VoucherService {
|
||||
const endpoint = type.replace(/ /g, '-').toLowerCase();
|
||||
return <Observable<Voucher>>this.http.get<Voucher>(`${url}/${endpoint}/${id}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'get'))
|
||||
catchError(this.log.handleError(serviceName, 'Get Voucher'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export class VoucherService {
|
||||
}
|
||||
return <Observable<Voucher>>this.http.get<Voucher>(`${url}/${endpoint}`, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'getOfType'))
|
||||
catchError(this.log.handleError(serviceName, 'Get Voucher of Type'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,22 +44,21 @@ export class VoucherService {
|
||||
const options = {params: new HttpParams().set('d', date)};
|
||||
return <Observable<Voucher>>this.http.get<Voucher>(`${url}/incentive`, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
catchError(this.log.handleError(serviceName, 'Get Incentive'))
|
||||
);
|
||||
}
|
||||
|
||||
post(id: string): Observable<Voucher> {
|
||||
const options = {params: new HttpParams().set('p', '')};
|
||||
return <Observable<Voucher>>this.http.post<Voucher>(`${url}/${id}`, {}, options)
|
||||
return <Observable<Voucher>>this.http.post<Voucher>(`${url}/post-voucher/${id}`, {})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
catchError(this.log.handleError(serviceName, 'Post Voucher'))
|
||||
);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<Voucher> {
|
||||
return <Observable<Voucher>>this.http.delete<Voucher>(`${url}/${id}`, httpOptions)
|
||||
return <Observable<Voucher>>this.http.delete<Voucher>(`${url}/delete/${id}`, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'delete'))
|
||||
catchError(this.log.handleError(serviceName, 'Delete Voucher'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ export class VoucherService {
|
||||
fd.append('data', JSON.stringify(voucher));
|
||||
return <Observable<Voucher>>this.http.post<Voucher>(`${url}/${endpoint}`, fd)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
catchError(this.log.handleError(serviceName, 'Save Voucher'))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,7 +95,7 @@ export class VoucherService {
|
||||
fd.append('data', JSON.stringify(voucher));
|
||||
return <Observable<Voucher>>this.http.put<Voucher>(`${url}/${endpoint}/${voucher.id}`, fd)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'update'))
|
||||
catchError(this.log.handleError(serviceName, 'Update Voucher'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user