fix: redirect sign-in to dashboard (#2718)

This commit is contained in:
Vyctor H. Brzezowski
2026-06-17 17:31:21 -07:00
committed by GitHub
parent 2d93401234
commit 1a3fdd8f51
2 changed files with 3 additions and 14 deletions
+2 -2
View File
@@ -342,7 +342,7 @@ describe("Header", () => {
fireEvent.click(screen.getByRole("button", { name: "Sign in with GitHub" }));
expect(signInMock).toHaveBeenCalledWith("github", { redirectTo: "/" });
expect(signInMock).toHaveBeenCalledWith("github", { redirectTo: "/dashboard" });
await waitFor(() => {
expect(setAuthError).toHaveBeenCalledWith("Sign in failed. Please try again.");
});
@@ -359,7 +359,7 @@ describe("Header", () => {
fireEvent.click(screen.getByRole("button", { name: "Sign in with GitHub" }));
expect(signInMock).toHaveBeenCalledWith("github", { redirectTo: "/" });
expect(signInMock).toHaveBeenCalledWith("github", { redirectTo: "/dashboard" });
await Promise.resolve();
expect(setAuthError).not.toHaveBeenCalled();
});
+1 -12
View File
@@ -133,8 +133,6 @@ export default function Header() {
api.publishers.getMyProfileHandle,
isAuthenticated && me ? {} : "skip",
);
const signInRedirectTo = getCurrentRelativeUrl();
const [navSearchQuery, setNavSearchQuery] = useState("");
const [typeaheadOpen, setTypeaheadOpen] = useState(false);
const [typeaheadTab, setTypeaheadTab] = useState<TypeaheadTab>("skills");
@@ -643,10 +641,7 @@ export default function Header() {
disabled={isLoading}
onClick={() => {
clearAuthError();
void signIn(
"github",
signInRedirectTo ? { redirectTo: signInRedirectTo } : undefined,
)
void signIn("github", { redirectTo: "/dashboard" })
.then((result) => {
if (result?.signingIn === false && !result.redirect) {
setAuthError("Sign in failed. Please try again.");
@@ -1013,12 +1008,6 @@ function getTypeaheadRowBody(item: TypeaheadItem) {
meta: null,
};
}
function getCurrentRelativeUrl() {
if (typeof window === "undefined") return "/";
return `${window.location.pathname}${window.location.search}${window.location.hash}`;
}
function NavbarThemeSwitcher({
mode,
onSetMode,