diff options
author | Frederick Yin <fkfd@fkfd.me> | 2023-07-25 14:58:13 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2023-07-25 14:58:13 +0800 |
commit | da56d489b72fb567f7566f745763d76557f2d648 (patch) | |
tree | c947955a166d9ccd482a1dd8b97459398c136f79 | |
parent | efc99db30f4f147c1cd3d7bef322bb5ed41ecbb4 (diff) |
Shorter message after fetching course
-rw-r--r-- | contents/ui/configCanvas.qml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/contents/ui/configCanvas.qml b/contents/ui/configCanvas.qml index 0940c1a..aed1a3e 100644 --- a/contents/ui/configCanvas.qml +++ b/contents/ui/configCanvas.qml @@ -21,7 +21,6 @@ Kirigami.FormLayout { } function fetchCourses() { - courses.clear() fetchCoursesStatus.text = i18n("Fetching…") let xhr = new XMLHttpRequest() xhr.open("GET", `${canvasUrl.text.replace(/\/$/, "")}/api/v1/courses?per_page=100`) @@ -29,19 +28,19 @@ Kirigami.FormLayout { xhr.onload = () => { if (xhr.status == 200) { try { + courses.clear() let json = JSON.parse(xhr.responseText) for (let c of json) { courses.append(`${c.id} ${c.course_code}`) } fetchCoursesStatus.text = i18n( - "Done! You can remove courses you don't wish to see on your desktop from " + - "the list.\nYou can also rename the course code, but leave the numeric " + - "course ID at the beginning of each line intact." + "Done! To remove a course, just delete the line.\n" + + "You can also rename a course, but do not change the numeric ID." ) } catch (e) { if (e instanceof SyntaxError) { console.error(`Cannot parse response for ${path} as JSON:\n${xhr.responseText}`) - fetchgCoursesStatus.text = i18n("Cannot parse API response") + fetchCoursesStatus.text = i18n("Cannot parse API response") } else { throw e } } } else { |