feat: validate login passed to background and implemented into add all injected button (#443)

* docs: proper captializing

* docs: confirmed that the for loop is entered but on first startup something else

* feat: turns out - validate login status - not in background - pass background now

* feat: kronk.gif

* Update UserScheduleMessages.ts

* Update addCourseByURL.ts

* chore: format

* chore: chore

---------

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
This commit is contained in:
2025-01-20 18:42:15 -06:00
committed by GitHub
parent f425510e11
commit cd05e5e7fc
4 changed files with 31 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ import renameSchedule from '@pages/background/lib/renameSchedule';
import switchSchedule from '@pages/background/lib/switchSchedule';
import type { UserScheduleMessages } from '@shared/messages/UserScheduleMessages';
import { Course } from '@shared/types/Course';
import { validateLoginStatus } from '@shared/util/checkLoginStatus';
import type { MessageHandler } from 'chrome-extension-toolkit';
const userScheduleHandler: MessageHandler<UserScheduleMessages> = {
@@ -41,6 +42,9 @@ const userScheduleHandler: MessageHandler<UserScheduleMessages> = {
.then(res => (response === 'json' ? res.json() : res.text()))
.then(sendResponse);
},
validateLoginStatus({ data, sendResponse }) {
validateLoginStatus(data.url).then(sendResponse);
},
exportSchedule({ data, sendResponse }) {
exportSchedule(data.scheduleId).then(sendResponse);
},