Skip to content

Commit

Permalink
swapped out to_form for gif changeset in upload modal
Browse files Browse the repository at this point in the history
  • Loading branch information
zackcreach committed Dec 19, 2024
1 parent 64a940a commit 923b153
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/gifmaster_web/live/home_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,17 @@ defmodule GifmasterWeb.HomeLive do
use GifmasterWeb, :live_view

alias Gifmaster.Catalog
alias Gifmaster.Catalog.Gif
alias Phoenix.LiveView.AsyncResult

def mount(_params, _session, socket) do
socket
|> assign(
title: "Gifmaster 5000",
description: "The best gifs you ever did see",
show_gif_upload_modal: false,
show_gif_upload_modal: true,
get_gifs_form: to_form(%{"search" => ""}),
# Switch out to_form to Catalog.create_gif()
upload_gif_form:
to_form(%{
"name" => "",
"tags" => [],
"file" => %{"url" => %{"relative" => "", "absolute" => ""}}
}),
gif_changeset: Gif.changeset(%Gif{}),
gifs: AsyncResult.loading()
)
|> assign_async(:gifs, fn -> {:ok, %{gifs: Catalog.get_gifs()}} end)
Expand Down Expand Up @@ -49,7 +44,7 @@ defmodule GifmasterWeb.HomeLive do
Upload Gif
</h2>
<.form for={@upload_gif_form}></.form>
<.form for={@gif_changeset}></.form>
</.modal>
"""
end
Expand Down

0 comments on commit 923b153

Please sign in to comment.