kunwp1 commented on code in PR #9332:
URL: https://github.com/apache/texera/pull/9332#discussion_r4509244410


##########
frontend/src/app/dashboard/service/user/quota/user-quota.service.ts:
##########
@@ -38,19 +38,23 @@ export class UserQuotaService {
   constructor(private http: HttpClient) {}
 
   public getCreatedDatasets(uid: number): 
Observable<ReadonlyArray<DatasetQuota>> {
-    return 
this.http.get<ReadonlyArray<DatasetQuota>>(`${USER_CREATED_DATASETS}`);
+    return this.getQuotaResource<DatasetQuota>(USER_CREATED_DATASETS);
   }
 
   public getCreatedWorkflows(uid: number): Observable<ReadonlyArray<Workflow>> 
{
-    return this.http.get<ReadonlyArray<Workflow>>(`${USER_CREATED_WORKFLOWS}`);
+    return this.getQuotaResource<Workflow>(USER_CREATED_WORKFLOWS);
   }
 
   public getAccessWorkflows(uid: number): Observable<ReadonlyArray<number>> {
-    return this.http.get<ReadonlyArray<number>>(`${USER_ACCESS_WORKFLOWS}`);
+    return this.getQuotaResource<number>(USER_ACCESS_WORKFLOWS);
   }
 
   public getExecutionQuota(uid: number): 
Observable<ReadonlyArray<ExecutionQuota>> {
-    return this.http.get<ReadonlyArray<ExecutionQuota>>(`${USER_QUOTA_SIZE}`);
+    return this.getQuotaResource<ExecutionQuota>(USER_QUOTA_SIZE);
+  }
+
+  private getQuotaResource<T>(url: string): Observable<ReadonlyArray<T>> {
+    return this.http.get<ReadonlyArray<T>>(url);
   }

Review Comment:
   This helper only forwards to `http.get`, so it doesn't remove any 
duplication: each method was already a one-line call, and it's still one line, 
just one hop further from the URL. I'd keep the direct `http.get` calls here 
and limit the PR to the admin helper, which does remove the repeated 
`HttpParams` setup.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to