}
}
+ private validateUuid(uuid: string) {
+ if (uuid === "") {
+ throw new Error('UUID cannot be empty string');
+ }
+ }
+
static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions, mapKeys = true, showErrors = true): Promise<R> {
const reqId = uuid();
actions.progressFn(reqId, true);
}
delete(uuid: string): Promise<T> {
+ this.validateUuid(uuid);
return CommonService.defaultResponse(
this.serverApi
.delete(this.resourceType + '/' + uuid),
}
get(uuid: string, showErrors?: boolean) {
+ this.validateUuid(uuid);
return CommonService.defaultResponse(
this.serverApi
.get<T>(this.resourceType + '/' + uuid),
}
update(uuid: string, data: Partial<T>) {
+ this.validateUuid(uuid);
return CommonService.defaultResponse(
this.serverApi
.put<T>(this.resourceType + '/' + uuid, data && CommonService.mapKeys(_.snakeCase)(data)),