add docs
All checks were successful
Deploy on Master Change / deploy (push) Successful in 44s

This commit is contained in:
2026-07-01 14:58:46 +07:00
parent dd766206f7
commit 0b02cc82b5
9 changed files with 992 additions and 2 deletions

View File

@@ -277,6 +277,16 @@ export interface GuideLinkItem {
url: string;
}
export interface AppDownloadItem {
id: number;
createdAt: string;
updatedAt: string;
name: string;
description: string;
downloadUrl: string;
platform: string;
}
export interface PaginatedResponse<T> {
data: T[];
total: number;
@@ -397,6 +407,33 @@ export const api = {
return res.json();
},
listAppDownloads: async (): Promise<{ data: AppDownloadItem[] }> => {
const res = await staffFetch('/app-downloads');
if (!res.ok) throw new Error('Không thể tải danh sách ứng dụng');
return res.json();
},
createAppDownload: async (name: string, description: string, downloadUrl: string, platform: string): Promise<{ data: AppDownloadItem }> => {
const res = await staffFetch('/app-downloads', {
method: 'POST',
body: JSON.stringify({ name, description, downloadUrl, platform }),
});
if (!res.ok) await parseError(res, 'Thêm ứng dụng thất bại');
return res.json();
},
updateAppDownload: async (id: number, name: string, description: string, downloadUrl: string, platform: string): Promise<{ data: AppDownloadItem }> => {
const res = await staffFetch(`/app-downloads/${id}`, {
method: 'PUT',
body: JSON.stringify({ name, description, downloadUrl, platform }),
});
if (!res.ok) await parseError(res, 'Cập nhật ứng dụng thất bại');
return res.json();
},
deleteAppDownload: async (id: number): Promise<{ ok: boolean }> => {
const res = await staffFetch(`/app-downloads/${id}`, { method: 'DELETE' });
if (!res.ok) await parseError(res, 'Xóa ứng dụng thất bại');
return res.json();
},
getClasses: async (params: {
page: number;
pageSize: number;