Skip to content

Commit

Permalink
fix: accidental typo in the refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth committed Oct 6, 2023
1 parent bf99063 commit af3ffc0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/logflare_web/live/alerts/alerts_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,19 @@ 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)
|> put_flash(:info, "Successfully #{verb} alert #{updated_alert.name}")
|> 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 =
Expand Down

0 comments on commit af3ffc0

Please sign in to comment.