Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Type

Manav Rathi82b12fcb370c
diff --git a/web/apps/accounts/src/pages/passkeys/index.tsx b/web/apps/accounts/src/pages/passkeys/index.tsx
index 09a7cd6ee4..b20c76ac1d 100644
--- a/web/apps/accounts/src/pages/passkeys/index.tsx
+++ b/web/apps/accounts/src/pages/passkeys/index.tsx
@@ -262,15 +262,15 @@ const ManagePasskeyDrawer: React.FC<ManagePasskeyDrawerProps> = ({
const [showRenameDialog, setShowRenameDialog] = useState(false);
const showDeleteConfirmationDialog = useCallback(() => {
- const handleDelete = async (setLoading?: (value: boolean) => void) => {
- setLoading && setLoading(true);
+ const handleDelete = async (setLoading: (value: boolean) => void) => {
+ setLoading(true);
try {
await deletePasskey(ensure(token), ensure(passkey).id);
onUpdateOrDeletePasskey();
} catch (e) {
log.error("Failed to delete passkey", e);
} finally {
- setLoading && setLoading(false);
+ setLoading(false);
}
};
@@ -284,7 +284,7 @@ const ManagePasskeyDrawer: React.FC<ManagePasskeyDrawerProps> = ({
},
close: { text: t("CANCEL") },
});
- }, [token, onUpdateOrDeletePasskey, passkey, setDialogBoxAttributesV2]);
+ }, [token, passkey, onUpdateOrDeletePasskey, setDialogBoxAttributesV2]);
return (
<>
diff --git a/web/packages/shared/components/DialogBoxV2/types.ts b/web/packages/shared/components/DialogBoxV2/types.ts
index 1f4ae3f3ab..cb89cb48c2 100644
--- a/web/packages/shared/components/DialogBoxV2/types.ts
+++ b/web/packages/shared/components/DialogBoxV2/types.ts
@@ -48,8 +48,15 @@ export interface DialogBoxAttributesV2 {
proceed?: {
/** The string to use as the label for the primary action. */
text: string;
- /** The function to call when the user presses the primary action button. */
- action: (setLoading?: (value: boolean) => void) => void | Promise<void>;
+ /**
+ * The function to call when the user presses the primary action button.
+ *
+ * It is passed a {@link setLoading} function that can be used to show
+ * or hide loading indicator or the primary action button.
+ */
+ action:
+ | (() => void | Promise<void>)
+ | ((setLoading: (value: boolean) => void) => void | Promise<void>);
variant?: ButtonProps["color"];
disabled?: boolean;
};