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

This commit is contained in:
2026-07-01 15:08:31 +07:00
parent 7a9c7a93ff
commit 7e84ddeaf9
8 changed files with 443 additions and 20 deletions

View File

@@ -287,6 +287,14 @@ export interface AppDownloadItem {
platform: string;
}
export interface AppGuideItem {
id: number;
createdAt: string;
updatedAt: string;
title: string;
url: string;
}
export interface PaginatedResponse<T> {
data: T[];
total: number;
@@ -434,6 +442,33 @@ export const api = {
return res.json();
},
listAppGuides: async (): Promise<{ data: AppGuideItem[] }> => {
const res = await staffFetch('/app-guides');
if (!res.ok) throw new Error('Không thể tải danh sách tài liệu hướng dẫn');
return res.json();
},
createAppGuide: async (title: string, url: string): Promise<{ data: AppGuideItem }> => {
const res = await staffFetch('/app-guides', {
method: 'POST',
body: JSON.stringify({ title, url }),
});
if (!res.ok) await parseError(res, 'Thêm tài liệu hướng dẫn thất bại');
return res.json();
},
updateAppGuide: async (id: number, title: string, url: string): Promise<{ data: AppGuideItem }> => {
const res = await staffFetch(`/app-guides/${id}`, {
method: 'PUT',
body: JSON.stringify({ title, url }),
});
if (!res.ok) await parseError(res, 'Cập nhật tài liệu hướng dẫn thất bại');
return res.json();
},
deleteAppGuide: async (id: number): Promise<{ ok: boolean }> => {
const res = await staffFetch(`/app-guides/${id}`, { method: 'DELETE' });
if (!res.ok) await parseError(res, 'Xóa tài liệu hướng dẫn thất bại');
return res.json();
},
getClasses: async (params: {
page: number;
pageSize: number;