sf8193
How do you decide where to redirect based on last webpage?
I have two tables, table A has a has_many relationship to table B.
to create an entry in table B, I have a link on the form_page of object A, redirecting to object B’s new page.
I want in the create function of object B to be able to redirect to a different page, based on where the request originated from, i.e. object A’s new page, or object A’s edit page. Is this possible? I saw in the conn object theres a before_send object, but I couldn’t figure out how to use it
First Post!
yurko
It’s possible, but you’d have to save the last path in session - here is a discussion with a sample implementation Add redirect to: :back. by danhper · Pull Request #1402 · phoenixframework/phoenix · GitHub and here is a library you can grab (or just add a similar plug) GitHub - danhper/plug-navigation-history: Elixir plug to keep navigation history · GitHub
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










