mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 17:15:09 +08:00
Use guards for checking live action
This commit is contained in:
parent
4681f98972
commit
37cb549d02
1 changed files with 6 additions and 7 deletions
|
@ -164,20 +164,19 @@ defmodule LivebookWeb.HomeLive do
|
|||
{:noreply, assign(socket, session: session)}
|
||||
end
|
||||
|
||||
def handle_params(
|
||||
%{"action" => action},
|
||||
_url,
|
||||
%{assigns: %{live_action: :edit_sessions}} = socket
|
||||
) do
|
||||
def handle_params(%{"action" => action}, _url, socket)
|
||||
when socket.assigns.live_action == :edit_sessions do
|
||||
{:noreply, assign(socket, bulk_action: action)}
|
||||
end
|
||||
|
||||
def handle_params(%{"tab" => tab} = params, _url, %{assigns: %{live_action: :import}} = socket) do
|
||||
def handle_params(%{"tab" => tab} = params, _url, socket)
|
||||
when socket.assigns.live_action == :import do
|
||||
import_opts = [url: params["url"]]
|
||||
{:noreply, assign(socket, tab: tab, import_opts: import_opts)}
|
||||
end
|
||||
|
||||
def handle_params(%{"url" => url}, _url, %{assigns: %{live_action: :public_import}} = socket) do
|
||||
def handle_params(%{"url" => url}, _url, socket)
|
||||
when socket.assigns.live_action == :public_import do
|
||||
origin = Livebook.ContentLoader.url_to_location(url)
|
||||
|
||||
origin
|
||||
|
|
Loading…
Reference in a new issue