У меня есть провайдер, в котором у меня много функций, есть ли способ выполнить функцию перед выполнением любого вызова функции в ionic.Вот мой код, и я хочу легко выполнить функцию загрузчика перед каждым вызовом HTTP, не вызывая функцию несколько раз
@Injectable()
export class HttpProvider {
BASEURL: string = 'https://www.ngrok.io';
constructor(public http: HttpClient) {
console.log('Hello HttpProvider Provider');
}
getCustomerInfo(customer_mobile) {
return this.http.post(this.BASEURL + '/customer/get', {
customer_mobile,
});
}
addNewCustomer(customerInfo) {
return this.http.post(this.BASEURL + '/customer/save', customerInfo);
}
updateCustomer(customerInfo) {
return this.http.post(this.BASEURL + '/customer/update', customerInfo);
}
getVendorList(filterObject) {
return this.http.post(this.BASEURL + '/getvendorlist', filterObject);
}
getVendorInfo(vendor_id) {
return this.http.post(this.BASEURL + '/getvendorinfo', {
vendor_id,
});
}
updateAddress(updatedAddress) {
return this.http.post(
this.BASEURL + '/customeraddress/update',
updatedAddress
);
}
addAddress(newAddress) {
return this.http.post(this.BASEURL + '/customeraddress/save', newAddress);
}
addOrder(orderDetails) {
return this.http.post(this.BASEURL + '/order/save', orderDetails);
}
deleteAddress(address_id) {
return this.http.post(this.BASEURL + '/customeraddress/delete', {
address_id,
});
}
getOrderList(customer_id, date?) {
return this.http.post(
this.BASEURL + '/fetchallcustomerorders',
requestBody
);
}
addReview(review: { feedback: string; rating: string; order_id: string }) {
return this.http.post(this.BASEURL + '/orderreview', review);
}
}