added authorization stores and fixed http client

This commit is contained in:
Fran Jurmanović
2021-05-29 17:11:21 +02:00
parent f835c76b39
commit f0d2e7b06d
23 changed files with 473 additions and 24 deletions

View File

@@ -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);
};
}