ash_hq/lib/ash_hq_web/init_assigns.ex

11 lines
361 B
Elixir

defmodule AshHqWeb.InitAssigns do
@moduledoc "Sets the platform being used with liveview"
import Phoenix.LiveView
def on_mount(:default, _params, _session, socket) do
case get_connect_params(socket) do
%{"_platform" => "ios"} -> {:cont, socket |> assign(:platform, :ios)}
_ -> {:cont, socket |> assign(:platform, :web)}
end
end
end