mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
We're migrating to ESM, which will allow us to import the latest versions of our dependencies. Co-Authored-By: Christopher Kolstad <chriswk@getunleash.io>
26 lines
672 B
TypeScript
26 lines
672 B
TypeScript
import type { LicensedUsersSchema } from 'openapi';
|
|
import {
|
|
useApiGetter,
|
|
fetcher,
|
|
} from './api/getters/useApiGetter/useApiGetter.js';
|
|
import { formatApiPath } from '../utils/formatPath.js';
|
|
|
|
const path = `api/admin/licensed-users`;
|
|
|
|
const placeholderData: LicensedUsersSchema = {
|
|
seatCount: 0,
|
|
licensedUsers: {
|
|
current: 0,
|
|
history: [],
|
|
},
|
|
};
|
|
|
|
export const useLicensedUsers = () => {
|
|
const { data, refetch, loading, error } = useApiGetter<LicensedUsersSchema>(
|
|
formatApiPath(path),
|
|
() => fetcher(formatApiPath(path), 'Seats used'),
|
|
);
|
|
|
|
return { data: data || placeholderData, refetch, loading, error };
|
|
};
|