♻️ Move throwing redirect exception into method
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / LikePage.kt
index 838a2eb..c8369e9 100644 (file)
@@ -11,8 +11,9 @@ import javax.inject.*
 /**
  * Page that lets the user like [net.pterodactylus.sone.data.Post]s and [net.pterodactylus.sone.data.Reply]s.
  */
+@ToadletPath("like.html")
 class LikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
-               LoggedInPage("like.html", "Page.Like.Title", webInterface, loaders, templateRenderer) {
+               LoggedInPage("Page.Like.Title", webInterface, loaders, templateRenderer) {
 
        override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) {
                if (soneRequest.isPOST) {
@@ -22,7 +23,7 @@ class LikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders,
                                        "reply" -> currentSone.addLikedReplyId(soneRequest.parameters["reply", 36]!!)
                                }
                        }
-                       throw RedirectException(soneRequest.parameters["returnPage", 256]!!)
+                       redirectTo(soneRequest.parameters["returnPage", 256]!!)
                }
        }