feat: 完成全部接口替换为新后端接口
This commit is contained in:
@@ -36,7 +36,9 @@ interface WorksheetPage {
|
||||
|
||||
/** 分类直接由服务端发布状态决定,不用本地目录补齐或恢复下架分类。 */
|
||||
export async function listCategories(): Promise<ApiCategory[]> {
|
||||
const rows = await apiRequest<ApiCategory[]>('/categories');
|
||||
const rows = await apiRequest<ApiCategory[]>('/categories', {
|
||||
auth: 'none',
|
||||
});
|
||||
if (
|
||||
!Array.isArray(rows) ||
|
||||
rows.some(
|
||||
@@ -87,6 +89,7 @@ export async function listAllWorksheets(): Promise<ApiWorksheet[]> {
|
||||
let expectedTotal: number | undefined;
|
||||
for (let page = 1; ; page++) {
|
||||
const result = await apiRequest<WorksheetPage>('/worksheets', {
|
||||
auth: 'none',
|
||||
data: { page, pageSize },
|
||||
});
|
||||
if (
|
||||
@@ -121,6 +124,7 @@ export async function listAllWorksheets(): Promise<ApiWorksheet[]> {
|
||||
export async function getWorksheet(id: string): Promise<ApiWorksheet> {
|
||||
const row = await apiRequest<ApiWorksheet>(
|
||||
`/worksheets/${encodeURIComponent(id)}`,
|
||||
{ auth: 'none' },
|
||||
);
|
||||
validateWorksheet(row);
|
||||
if (row.id !== id) throw new Error('题型数据异常,请稍后重试');
|
||||
|
||||
Reference in New Issue
Block a user