geo/frontend/lib/api/usage.ts

26 lines
558 B
TypeScript

import { fetchWithAuth } from "./client";
export interface UsageQuota {
label: string;
current: number;
limit: number;
unit?: string;
}
export interface UsageResponse {
plan: string;
quotas: UsageQuota[];
}
export const usageApi = {
getQuotas: async (token: string): Promise<UsageResponse> =>
fetchWithAuth("/api/v1/usage/quotas", {}, token),
getROI: async (token: string): Promise<{
roi_percentage: number;
value_generated: number;
subscription_cost: number;
}> =>
fetchWithAuth("/api/v1/usage/roi", {}, token),
};