File size: 486 Bytes
88211d3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | defmodule PlausibleWeb.Plugins.API.Views.CustomProp do
@moduledoc """
View for rendering Custom Props in the Plugins API
"""
use PlausibleWeb, :plugins_api_view
def render("index.json", %{props: props}) do
%{
custom_props: render_many(props, __MODULE__, "custom_prop.json", as: :custom_prop)
}
end
def render("custom_prop.json", %{
custom_prop: custom_prop
}) do
%{
custom_prop: %{
key: custom_prop
}
}
end
end
|