Skip to content

Commit

Permalink
fix: non-login user should not see remote option
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Mar 19, 2024
1 parent 13903bc commit 3587b01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/connect/connection-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default function ConnectionList({
if (showAddConnection) {
return (
<SaveConnection
user={user}
onClose={() => setShowAddConnection(false)}
onSaveComplete={onSaveComplete}
/>
Expand Down
11 changes: 9 additions & 2 deletions src/app/connect/saved-connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@ import {
} from "@/app/connect/saved-connection-storage";
import SavedConnectionConfig from "./saved-connection-config";
import { createDatabase } from "@/lib/api/fetch-databases";
import { User } from "lucia";

type SaveConnectionStep = "storage" | "config";

export default function SaveConnection({
user,
onSaveComplete,
onClose,
}: Readonly<{
user: User | null;
onSaveComplete: (storageType: SavedConnectionItem) => void;
onClose: () => void;
}>) {
const [storage, setStorage] = useState<SavedConnectionStorage>();
const [step, setStep] = useState<SaveConnectionStep>("storage");
const [storage, setStorage] = useState<SavedConnectionStorage | undefined>(
user ? undefined : "local"
);
const [step, setStep] = useState<SaveConnectionStep>(
user ? "storage" : "config"
);
const [loading, setLoading] = useState(false);

const onConnectionTypeSelected = useCallback(
Expand Down

0 comments on commit 3587b01

Please sign in to comment.