♻️ Move throwing redirect exception into method
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / CreateSonePage.kt
index ef0c304..0b690da 100644 (file)
@@ -14,8 +14,9 @@ import javax.inject.*
  */
 @MenuName("CreateSone")
 @TemplatePath("/templates/createSone.html")
+@ToadletPath("createSone.html")
 class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
-               SoneTemplatePage("createSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.CreateSone.Title") {
+               SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.CreateSone.Title") {
 
        private val logger = Logger.getLogger(CreateSonePage::class.java.name)
 
@@ -30,7 +31,7 @@ class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Lo
                                        logger.log(Level.SEVERE, "Could not create Sone for OwnIdentity: $ownIdentity")
                                }
                                setCurrentSone(soneRequest.toadletContext, sone)
-                               throw RedirectException("index.html")
+                               redirectTo("index.html")
                        }
                        templateContext["errorNoIdentity"] = true
                }