mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
added authorization stores and fixed http client
This commit is contained in:
@@ -1,29 +1,26 @@
|
||||
import { HttpClient } from "core/services";
|
||||
import { AppService, HttpClient } from "core/services";
|
||||
|
||||
class BaseService {
|
||||
private httpClient: HttpClient;
|
||||
constructor(private endpoint: string) {
|
||||
this.httpClient = new HttpClient();
|
||||
}
|
||||
constructor(public endpoint: string, public appService: AppService) {}
|
||||
|
||||
getAll = (headers?: HeadersInit) => {
|
||||
return this.httpClient.get(this.endpoint, null, headers);
|
||||
return this.appService.get(this.endpoint, null, headers);
|
||||
};
|
||||
|
||||
get = (params?: Object, headers?: HeadersInit) => {
|
||||
return this.httpClient.get(this.endpoint, params, headers);
|
||||
return this.appService.get(this.endpoint, params, headers);
|
||||
};
|
||||
|
||||
put = (data?: Object, headers?: HeadersInit) => {
|
||||
return this.httpClient.put(this.endpoint, data, headers);
|
||||
return this.appService.put(this.endpoint, data, headers);
|
||||
};
|
||||
|
||||
post = (data?: Object, headers?: HeadersInit) => {
|
||||
return this.httpClient.post(this.endpoint, data, headers);
|
||||
return this.appService.post(this.endpoint, data, headers);
|
||||
};
|
||||
|
||||
delete = (data?: Object, headers?: HeadersInit) => {
|
||||
return this.httpClient.delete(this.endpoint, data, headers);
|
||||
return this.appService.delete(this.endpoint, data, headers);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user