fixes + lightbulb

This commit is contained in:
2021-09-08 16:30:37 +02:00
parent 90d0f64f67
commit 9755373c8f
6 changed files with 47 additions and 73 deletions
@@ -0,0 +1,16 @@
defmodule PokemonCoutureWeb.ClothesTrackerLive do
use PokemonCoutureWeb, :live_view
def mount(_params, _session, socket) do
socket = assign(socket, :light_bulb_status, "off")
{:ok, socket}
end
def handle_event("on", _value, socket) do
socket =
socket
|> assign(:light_bulb_status, "on")
{:noreply, socket}
end
end
@@ -0,0 +1,2 @@
<h1>The light is <%= @light_bulb_status %>.</h1>
<button phx-click="on">On</button>