From da56d489b72fb567f7566f745763d76557f2d648 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 25 Jul 2023 14:58:13 +0800 Subject: Shorter message after fetching course --- contents/ui/configCanvas.qml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'contents/ui/configCanvas.qml') 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 { -- cgit v1.2.3