Skip to content

Commit

Permalink
fix: Fix extract_resource_module fn
Browse files Browse the repository at this point in the history
  • Loading branch information
olafbado committed Mar 13, 2024
1 parent e0b93f2 commit f9e0481
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/permit_phoenix/live_view/authorize_hook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ defmodule Permit.Phoenix.LiveView.AuthorizeHook do
end)
end

defp extract_resource_module(events, action, default) do
defp extract_resource_module(events, action, default_resource_module) do
action = Atom.to_string(action)

events
|> Enum.find({nil, default}, fn {event, _resource_module} ->
|> Enum.find({nil, nil}, fn {event, _resource_module} ->
event == action
end)
|> then(fn {_, resource_module} -> resource_module end)
|> then(fn {_, resource_module} -> resource_module || default_resource_module end)
end
end

0 comments on commit f9e0481

Please sign in to comment.