From af3ffc03e021d1417adedd2e48a989a0c93aeb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Fri, 6 Oct 2023 10:20:28 +0200 Subject: [PATCH] fix: accidental typo in the refactored code --- lib/logflare_web/live/alerts/alerts_live.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/logflare_web/live/alerts/alerts_live.ex b/lib/logflare_web/live/alerts/alerts_live.ex index 1a4e98047..20fb5f7f8 100644 --- a/lib/logflare_web/live/alerts/alerts_live.ex +++ b/lib/logflare_web/live/alerts/alerts_live.ex @@ -78,10 +78,10 @@ defmodule LogflareWeb.AlertsLive do ) do Logger.debug("Saving alert", params: params) - verb = if alert, do: "updated", else: "created" - case upsert_alert(alert, user, params) do {:ok, updated_alert} -> + verb = if alert, do: "updated", else: "created" + {:noreply, socket |> assign(:alert, updated_alert) @@ -89,6 +89,8 @@ defmodule LogflareWeb.AlertsLive do |> push_patch(to: ~p"/alerts/#{updated_alert.id}")} {:error, %Ecto.Changeset{} = changeset} -> + verb = if alert, do: "update", else: "create" + message = "Could not #{verb} alert. Please fix the errors before trying again." socket =