Copyright | (c) digitally induced GmbH 2020 |
---|---|
Safe Haskell | None |
IHP.Controller.Redirect
Description
Synopsis
- redirectTo :: (?context :: ControllerContext, HasPath action) => action -> IO ()
- redirectToPath :: (?context :: ControllerContext) => Text -> IO ()
- redirectToUrl :: (?context :: ControllerContext) => Text -> IO ()
- forceRedirectToPath :: (?context :: ControllerContext) => Text -> IO ()
Documentation
redirectTo :: (?context :: ControllerContext, HasPath action) => action -> IO () Source #
Redirects to an action
Example:
redirectTo ShowProjectAction { projectId = get #id project }
Use redirectToPath
if you want to redirect to a non-action url.
redirectToPath :: (?context :: ControllerContext) => Text -> IO () Source #
Redirects to a path (given as a string)
Example:
redirectToPath "/blog/wp-login.php"
Use redirectTo
if you want to redirect to a controller action.
redirectToUrl :: (?context :: ControllerContext) => Text -> IO () Source #
Redirects to a url (given as a string)
Example:
redirectToUrl "https://example.com/hello-world.html"
Use redirectToPath
if you want to redirect to a relative path like /hello-world.html
forceRedirectToPath :: (?context :: ControllerContext) => Text -> IO () Source #
like redirectToPath
, but forcing full page reload
Forces reload by using a custom HTTP OK header mimicking a HTTP redirect which is used as a signal to the AJAX call to perform page reload. currently this is a workaround of last resort when you can't make your Javscript code behave properly together with morphdom and/or turbolinks
use 'forceRedirectToPath (pathTo action)' if you want to redirect to a controller action