Skip to content

Commit 31ee841

Browse files
committed
fix: redirect logic in apply with github
1 parent d21474b commit 31ee841

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

lib/algora_web/live/home_live.ex

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,16 +602,10 @@ defmodule AlgoraWeb.HomeLive do
602602
{:noreply, put_flash(socket, :error, "Failed to submit application. Please try again.")}
603603
end
604604
else
605-
{:noreply,
606-
socket
607-
|> push_event("store-session", %{user_return_to: "/jobs"})
608-
|> redirect(external: Algora.Github.authorize_url())}
605+
{:noreply, redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/jobs"}))}
609606
end
610607
else
611-
{:noreply,
612-
socket
613-
|> push_event("store-session", %{user_return_to: "/jobs"})
614-
|> redirect(external: Algora.Github.authorize_url())}
608+
{:noreply, redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/jobs"}))}
615609
end
616610
end
617611

lib/algora_web/live/jobs_live.ex

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -522,16 +522,10 @@ defmodule AlgoraWeb.JobsLive do
522522
{:noreply, put_flash(socket, :error, "Failed to submit application. Please try again.")}
523523
end
524524
else
525-
{:noreply,
526-
socket
527-
|> push_event("store-session", %{user_return_to: "/jobs"})
528-
|> redirect(external: Algora.Github.authorize_url())}
525+
{:noreply, redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/jobs"}))}
529526
end
530527
else
531-
{:noreply,
532-
socket
533-
|> push_event("store-session", %{user_return_to: "/jobs"})
534-
|> redirect(external: Algora.Github.authorize_url())}
528+
{:noreply, redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/jobs"}))}
535529
end
536530
end
537531

lib/algora_web/live/org/jobs_live.ex

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,11 @@ defmodule AlgoraWeb.Org.JobsLive do
170170
end
171171
else
172172
{:noreply,
173-
socket
174-
|> push_event("store-session", %{user_return_to: "/jobs"})
175-
|> redirect(external: Algora.Github.authorize_url())}
173+
redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/org/#{@current_org.handle}/jobs"}))}
176174
end
177175
else
178176
{:noreply,
179-
socket
180-
|> push_event("store-session", %{user_return_to: "/jobs"})
181-
|> redirect(external: Algora.Github.authorize_url())}
177+
redirect(socket, external: Algora.Github.authorize_url(%{return_to: "/org/#{@current_org.handle}/jobs"}))}
182178
end
183179
end
184180

0 commit comments

Comments
 (0)