Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rayrayzayzay/ec0b746bc26473f279e9cc28dccee5f5 to your computer and use it in GitHub Desktop.
Save rayrayzayzay/ec0b746bc26473f279e9cc28dccee5f5 to your computer and use it in GitHub Desktop.
defmodule Felt.Channels.ElementHandler do
def handle_event(event, payload, socket) when event in ["create", "update", "delete"] do
plugs = [
&ensure_authenticated/4,
&ensure_map_editable/4,
{&check_feature_flag/4, :element_importing}
]
with {:cont, socket, payload, bindings} <- ChannelHandler.process_plugs(plugs, socket, payload) do
do_handle_event(event, socket, payload, bindings)
end
end
defp do_handle_event("create", socket, payload, bindings) do
# Create the element
end
# Other handlers and functions
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment