Skip to content

Commit

Permalink
docs: two examples for redirect/2 (#2788)
Browse files Browse the repository at this point in the history
How to redirect to external url.
  • Loading branch information
karlosmid authored Aug 30, 2023
1 parent 8c4fc85 commit c60dc28
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,12 @@ defmodule Phoenix.LiveView do
* `:to` - the path to redirect to. It must always be a local path
* `:external` - an external path to redirect to. Either a string
or `{scheme, url}` to redirect to a custom scheme
## Examples
{:noreply, redirect(socket, to: "/")}
{:noreply, redirect(socket, external: "https://example.com")}
"""
def redirect(socket, opts \\ [])

Expand Down

0 comments on commit c60dc28

Please sign in to comment.