neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
make the gbfs-search form actually behave.
232a430 · gmorell · 2024-02-04 22:44
Files changed
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/form_component.ex
+12
−0
@@ -80,6 +80,18 @@ defmodule RoomSanctumWeb.QueryLive.FormComponent do
| 80 | 80 | {:noreply, socket |> assign(:results, []) |> assign_form(changeset)} |
| 81 | 81 | end |
| 82 | 82 | |
| 83 | + def handle_event("set-gbfs", %{"val" => stop, "type" => type}, socket) do | |
| 84 | + IO.inspect(socket.assigns.query) | |
| 85 | + changeset = | |
| 86 | + socket.assigns.query | |
| 87 | + |> Configuration.change_query(%{"query" => %{"stop" => stop, "__type__" => type}, "__type__" => type}) | |
| 88 | + # |> Ecto.Changeset.change(%{query: %{stop: stop, __type__: type}}) | |
| 89 | + |> Map.put(:action, :validate) | |
| 90 | + |> IO.inspect | |
| 91 | + IO.inspect(changeset.data) | |
| 92 | + {:noreply, socket |> assign(:results, []) |> assign_form(changeset)} | |
| 93 | + end | |
| 94 | + | |
| 83 | 95 | defp save_query(socket, :edit, query_params) do |
| 84 | 96 | case Configuration.update_query(socket.assigns.query, query_params) do |
| 85 | 97 | {:ok, query} -> |
Parents: 225be87