This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user