Skip to content

Commit

Permalink
use send_configuration internally
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetised committed Nov 18, 2024
1 parent 21cf9c6 commit 60262e5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/electric/phoenix/plug.ex
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ defmodule Electric.Phoenix.Plug do
defp return_configuration(conn, _opts) do
shape = conn.assigns.shape
client = get_in(conn.assigns, [:config, :client]) |> build_client()
config = Gateway.configuration(shape, client)

conn
|> put_resp_content_type("application/json")
|> send_resp(200, Jason.encode!(config))
send_configuration(conn, shape, client)
end

defp shape_definition(conn, opts)
Expand Down Expand Up @@ -337,9 +333,7 @@ defmodule Electric.Phoenix.Plug do
"""
@spec send_configuration(Plug.Conn.t(), Electric.Phoenix.shape_definition(), Client.t()) ::
Plug.Conn.t()
def send_configuration(conn, shape_or_queryable, client \\ Electric.Phoenix.client!())

def send_configuration(conn, shape_or_queryable, client) do
def send_configuration(conn, shape_or_queryable, client \\ Electric.Phoenix.client!()) do
configuration = Gateway.configuration(shape_or_queryable, client)

conn
Expand Down

0 comments on commit 60262e5

Please sign in to comment.