♻️ Move throwing redirect exception into method
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / OptionsPage.kt
index 31f2d89..2c454e8 100644 (file)
@@ -14,8 +14,9 @@ import javax.inject.*
  */
 @MenuName("Options")
 @TemplatePath("/templates/options.html")
-class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer):
-               SoneTemplatePage("options.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Options.Title") {
+@ToadletPath("options.html")
+class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
+               SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.Options.Title") {
 
        override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) {
                if (soneRequest.isPOST) {
@@ -65,7 +66,7 @@ class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loade
 
                        if (fieldsWithErrors.isEmpty()) {
                                soneRequest.core.touchConfiguration()
-                               throw RedirectException("options.html")
+                               redirectTo("options.html")
                        }
                        templateContext["fieldErrors"] = fieldsWithErrors
                }