Skip to content

Commit

Permalink
Merge pull request #26 from wkirschbaum/fix-typespecs-for-put_toast
Browse files Browse the repository at this point in the history
fix: use String.Chars.t() instead of binary() for put_toast message
  • Loading branch information
srcrip authored Dec 27, 2024
2 parents c0511c0 + 76d1814 commit c6fa6a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/live_toast.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ defmodule LiveToast do
"""
def put_toast(conn_or_socket, kind, msg, options \\ [])

@spec put_toast(Plug.Conn.t(), atom(), binary(), [option()]) :: Plug.Conn.t()
@spec put_toast(Plug.Conn.t(), atom(), String.Chars.t(), [option()]) :: Plug.Conn.t()
def put_toast(%Plug.Conn{} = conn, kind, msg, _options) do
Phoenix.Controller.put_flash(conn, kind, msg)
end

@spec put_toast(LiveView.Socket.t(), atom(), binary(), [option()]) :: LiveView.Socket.t()
@spec put_toast(LiveView.Socket.t(), atom(), String.Chars.t(), [option()]) :: LiveView.Socket.t()
def put_toast(%LiveView.Socket{} = socket, kind, msg, options) do
options = Keyword.put(options, :sync, true)

Expand Down

0 comments on commit c6fa6a2

Please sign in to comment.