From f896e5f721963c5a73339b57f6f3e9eb6779cb56 Mon Sep 17 00:00:00 2001 From: Brian Cardarella Date: Tue, 16 Jan 2024 04:40:38 -0500 Subject: [PATCH] Add csrf token component --- lib/live_view_native/stylesheet/component.ex | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/live_view_native/stylesheet/component.ex b/lib/live_view_native/stylesheet/component.ex index 66b7968..7c2108c 100644 --- a/lib/live_view_native/stylesheet/component.ex +++ b/lib/live_view_native/stylesheet/component.ex @@ -25,4 +25,16 @@ defmodule LiveViewNative.Stylesheet.Component do """ end + + @doc """ + Embed the CSRF token for LiveView as a tag + """ + def csrf_token(assigns) do + csrf_token = Phoenix.Controller.get_csrf_token() + + assigns = Map.put(assigns, :csrf_token, csrf_token) + ~LVN""" + + """ + end end \ No newline at end of file