useBackupAuth
useBackupAuth():
BackupAuthContextValue
Defined in: src/react/useBackupAuth.ts:236Â
Hook to access unified backup authentication state and methods.
Must be used within a BackupAuthProvider.
Returns
Example
import { useBackupAuth } from "@anuma/sdk/react";
function BackupSettings() {
const { icloud, logoutAll } = useBackupAuth();
if (!icloud.isConfigured) return null;
return (
<div>
<span>iCloud: {icloud.isAuthenticated ? 'Connected' : 'Not connected'}</span>
{icloud.isAuthenticated ? (
<button onClick={logoutAll}>Disconnect</button>
) : (
<button onClick={icloud.requestAccess}>Connect</button>
)}
</div>
);
}Last updated on