mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 08:52:21 +00:00
fix: redirect sign-in to dashboard (#2718)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user