Packages

This is a CMS written in Elixir. Aims to be the great open-source ecommerce and/or startup solution for those who are searching for a performance and stability on top of modern technologies like React and Elixir.

Current section

Files

Jump to
lyn web controllers helpers.ex
Raw

web/controllers/helpers.ex

defmodule Lyn.Controller.Helpers do
import Plug.Conn
def redirect_back(conn, alternative \\ "/") do
path = conn
|> get_req_header("referer")
|> referrer
path || alternative
end
defp referrer([]), do: nil
defp referrer([h|_]), do: h
end