Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions apps/vscode/webview-ui/src/components/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import { useSettingsStore } from "@/stores";
import { bridge } from "@/services";
import { toast } from "@/components/ui/sonner";
import { cn } from "@/lib/utils";

interface ActionMenuProps {
Expand Down Expand Up @@ -71,16 +72,23 @@ export function ActionMenu({ className, onAuthAction }: ActionMenuProps) {
};

const handleAuthAction = async () => {
if (isLoggedIn) {
setLoading(true);
try {
setLoading(true);
try {
if (isLoggedIn) {
await bridge.logout();
setIsLoggedIn(false);
} finally {
setLoading(false);
} else {
const result = await bridge.login();
if (result.success) {
setIsLoggedIn(true);
} else {
toast.error(result.error ?? "Sign-in failed. Check the logs for details.");
}
}
} finally {
setLoading(false);
setOpen(false);
}
setOpen(false);
onAuthAction?.();
};

Expand Down
Loading