Skip to content

Commit 635da30

Browse files
feat: change path based on user type
1 parent ef09bdc commit 635da30

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/safira_web/live/app/profile_live/index.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,12 @@ defmodule SafiraWeb.App.ProfileLive.Index do
2424
socket
2525
|> assign(:page_title, "Edit Profile")
2626
end
27+
28+
defp return_path(user) do
29+
case user.type do
30+
:attendee -> "app"
31+
:staff -> "dashboard"
32+
_ -> "app"
33+
end
34+
end
2735
end

lib/safira_web/live/app/profile_live/index.html.heex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
</:actions>
77
</.page>
88

9-
<.modal :if={@live_action in [:edit]} id="profile-modal" show on_cancel={JS.patch(~p"/")}>
9+
<.modal
10+
:if={@live_action in [:edit]}
11+
id="profile_settings-modal"
12+
show
13+
on_cancel={JS.patch(~p"/#{return_path(@current_user)}")}
14+
>
1015
<.live_component
1116
module={SafiraWeb.App.ProfileLive.FormComponent}
1217
id="profile"
1318
current_user={@current_user}
1419
action={@live_action}
15-
patch={~p"/"}
20+
patch={~p"/#{return_path(@current_user)}"}
1621
page_title={@page_title}
1722
/>
1823
</.modal>

0 commit comments

Comments
 (0)