This commit is contained in:
@@ -112,6 +112,20 @@ export type LauncherNotice = {
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export type LauncherTerm = {
|
||||
id: string;
|
||||
no?: number;
|
||||
key: string;
|
||||
body: string;
|
||||
isRequired: boolean;
|
||||
createdById?: string | null;
|
||||
createdByName?: string | null;
|
||||
createdByEmail?: string | null;
|
||||
createdByAvatarUrl?: string | null;
|
||||
createdAt: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export async function loadAdminsPage(params?: PageParams & { role?: string; state?: string }): Promise<PagedResponse<AdminAccount>> {
|
||||
type RawAdminAccount = Omit<AdminAccount, 'appPermissions'> & {
|
||||
appPermissions?: Array<string | { appId: string }>;
|
||||
@@ -332,6 +346,43 @@ export function deleteLauncherNotice(noticeId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadTermsPage(params?: PageParams & { key?: string }): Promise<PagedResponse<LauncherTerm>> {
|
||||
const response = await apiRequest<{ terms?: LauncherTerm[]; total?: number; page?: number; limit?: number }>(`/terms${pageQuery(params)}`);
|
||||
const items = response.terms ?? [];
|
||||
return { items, total: response.total ?? items.length, page: response.page ?? params?.page ?? 1, limit: response.limit ?? params?.limit ?? items.length };
|
||||
}
|
||||
|
||||
export function createTerm(payload: {
|
||||
key: string;
|
||||
body: string;
|
||||
isRequired?: boolean;
|
||||
}) {
|
||||
return apiRequest<{ term: LauncherTerm }>('/terms', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function updateTerm(
|
||||
termId: string,
|
||||
payload: Partial<{
|
||||
key: string;
|
||||
body: string;
|
||||
isRequired: boolean;
|
||||
}>
|
||||
) {
|
||||
return apiRequest<{ term: LauncherTerm }>(`/terms/${termId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteTerm(termId: string) {
|
||||
return apiRequest<{ ok: boolean }>(`/terms/${termId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
}
|
||||
|
||||
export type LicensePlan = {
|
||||
id: string;
|
||||
code: string;
|
||||
|
||||
Reference in New Issue
Block a user