2024-07-29 20:40:35 +05:30
|
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
2024-07-11 15:12:54 +05:30
|
|
|
// services
|
|
|
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
|
|
|
|
|
|
export type TFeatureFlagsResponse = {
|
|
|
|
|
values: {
|
|
|
|
|
[featureFlag: string]: boolean;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export class FeatureFlagService extends APIService {
|
|
|
|
|
constructor() {
|
2024-07-29 20:40:35 +05:30
|
|
|
super(API_BASE_URL);
|
2024-07-11 15:12:54 +05:30
|
|
|
}
|
|
|
|
|
|
2024-07-29 20:40:35 +05:30
|
|
|
async getFeatureFlags(workspaceSlug: string): Promise<TFeatureFlagsResponse> {
|
2024-08-05 14:08:05 +05:30
|
|
|
return this.get(`/api/payments/workspaces/${workspaceSlug}/flags/`)
|
2024-07-11 15:12:54 +05:30
|
|
|
.then((response) => response?.data)
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
throw error?.response?.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|