Once created, we will not be able to show the Token again.
Please copy the Token now and store it in a secure place.
You'll need to paste it in the settings area of the Plausible WordPress plugin.
"""
end
def handle_event("save-token", %{"token" => %{"description" => description}}, socket) do
case Tokens.create(socket.assigns.site, description, socket.assigns.token) do
{:ok, token, _} ->
send(socket.assigns.rendered_by, {:token_added, token})
{:noreply, socket}
{:error, changeset} ->
{:noreply, assign(socket, form: to_form(changeset))}
end
end
def handle_event("cancel-add-token", _value, socket) do
send(socket.assigns.rendered_by, :cancel_add_token)
{:noreply, socket}
end
end