From 45fd92aa041f93e3c961bb0640b466de1a10dfb0 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Tue, 13 Apr 2021 13:28:57 +0200 Subject: [PATCH] chore: add getCFavouriteR handler+route --- routes | 2 +- src/Handler/Course.hs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/routes b/routes index dc491efca..223c0114e 100644 --- a/routes +++ b/routes @@ -174,7 +174,7 @@ !/course/new CourseNewR GET POST !lecturer /course/#TermId/#SchoolId/#CourseShorthand CourseR !lecturer: / CShowR GET !tutor !corrector !exam-corrector !course-registered !course-time !evaluation !exam-office !allocation-admin - /favourite CFavouriteR POST !free + /favourite CFavouriteR GET POST !free /register CRegisterR GET POST !timeANDcapacityANDallocation-timeAND¬course-registeredANDcourse-time !timeANDallocation-timeAND¬exam-resultANDcourse-registered !lecturerANDallocation-time /register-template CRegisterTemplateR GET !course-time /edit CEditR GET POST diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 1f3ee0117..0247f13b8 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -34,6 +34,9 @@ getCNotesR, postCNotesR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCNotesR = postCNotesR postCNotesR _ _ _ = defaultLayout [whamlet|You have corrector access to this course.|] +-- simple redirect for now to avoid running into HTTP method not supported. +getCFavouriteR :: TermId -> SchoolId -> CourseShorthand -> Handler () +getCFavouriteR tid ssh csh = redirect $ CourseR tid ssh csh CShowR postCFavouriteR :: TermId -> SchoolId -> CourseShorthand -> Handler () postCFavouriteR tid ssh csh = void $ do authPair@(uid, _) <- requireAuthPair