From d8f429b94d2a39f20fca15ede0f15efede383051 Mon Sep 17 00:00:00 2001 From: xiaolu-lujunji Date: Wed, 23 Nov 2022 17:15:57 +0800 Subject: [PATCH] fix: termId (#20) --- package.json | 2 +- src-tauri/tauri.conf.json | 2 +- src/@types/index.d.ts | 3 +++ src/features/chapter-tree-view/ChapterTreeView.tsx | 2 +- src/lib/request.ts | 8 +++++++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0f463e1..4726abf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mooc-helper", - "version": "0.1.0", + "version": "0.1.1", "private": false, "license": "MIT", "scripts": { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0b92993..bbe1577 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "mooc-helper", - "version": "0.1.0" + "version": "0.1.1" }, "tauri": { "allowlist": { diff --git a/src/@types/index.d.ts b/src/@types/index.d.ts index 429349c..3c6150f 100644 --- a/src/@types/index.d.ts +++ b/src/@types/index.d.ts @@ -14,6 +14,9 @@ interface Course { imgUrl: string; fromCourseId: number; schoolPanel: SchoolPanel; + termPanel: { + id: number; + }; } interface SchoolPanel { diff --git a/src/features/chapter-tree-view/ChapterTreeView.tsx b/src/features/chapter-tree-view/ChapterTreeView.tsx index fda05a9..b672208 100644 --- a/src/features/chapter-tree-view/ChapterTreeView.tsx +++ b/src/features/chapter-tree-view/ChapterTreeView.tsx @@ -23,7 +23,7 @@ export default function ChapterTreeView() { try { const { status, results } = await courseInfo( course.id, - course.currentTermId + course.termPanel.id ); if (status.code === 0) { setChapters(results.termDto.chapters); diff --git a/src/lib/request.ts b/src/lib/request.ts index c4e1e83..deacec1 100644 --- a/src/lib/request.ts +++ b/src/lib/request.ts @@ -14,7 +14,10 @@ async function requestWeb(options: RequestOptions) { const response = await ky(options.url, { prefixUrl: "/api", method: options.method, - headers: options.headers, + headers: { + ...options.headers, + "edu-app-type": "android", + }, searchParams: { ...options.query, "mob-token": mobToken ?? "", @@ -44,6 +47,9 @@ async function requestTauri(options: RequestOptions) { const client = await getClient(); const response = await client.request({ url: `https://www.icourse163.org/${url}`, + headers: { + "edu-app-type": "android", + }, query: handledQuery, ...other, });