This commit is contained in:
2026-06-30 15:53:01 +07:00
parent 595aebd8a5
commit 74b540cac2
19 changed files with 1719 additions and 252 deletions

View File

@@ -502,6 +502,38 @@ export const apiFetchAppPool = async (q = '', limit = 50): Promise<{ data: AppPo
return res.json();
};
export interface AppTemplateItem {
id: number;
name: string;
description: string;
keywords: string;
createdAt: string;
updatedAt: string;
}
export const apiAppTemplates = {
list: async (): Promise<{ data: AppTemplateItem[] }> => {
const res = await staffFetch('/app-templates');
if (!res.ok) throw new Error('Không tải được khung ứng dụng');
return res.json();
},
create: async (body: { name: string; description?: string; keywords: string }) => {
const res = await staffFetch('/app-templates', { method: 'POST', body: JSON.stringify(body) });
if (!res.ok) await parseError(res, 'Không tạo được khung');
return res.json();
},
update: async (id: number, body: { name?: string; description?: string; keywords?: string }) => {
const res = await staffFetch(`/app-templates/${id}`, { method: 'PATCH', body: JSON.stringify(body) });
if (!res.ok) await parseError(res, 'Không cập nhật được khung');
return res.json();
},
delete: async (id: number) => {
const res = await staffFetch(`/app-templates/${id}`, { method: 'DELETE' });
if (!res.ok) await parseError(res, 'Không xóa được khung');
return res.json();
},
};
export interface WifiPoolItem {
id: number;
ssid: string;