Created
April 14, 2023 00:51
-
-
Save rayrayzayzay/ec0b746bc26473f279e9cc28dccee5f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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