This commit is contained in:
reya
2023-12-07 11:50:25 +07:00
parent a42a2788ea
commit 95124e5ded
28 changed files with 1547 additions and 301 deletions
+3 -11
View File
@@ -3,26 +3,18 @@ import { useQueryClient } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner';
import { useNDK } from '@libs/ndk/provider';
import { useStorage } from '@libs/storage/provider';
import { useArk } from '@libs/ark';
export function Logout() {
const { db } = useStorage();
const { ndk } = useNDK();
const { ark } = useArk();
const navigate = useNavigate();
const queryClient = useQueryClient();
const logout = async () => {
try {
ndk.signer = null;
// remove private key
await db.secureRemove(db.account.pubkey);
await db.secureRemove(`${db.account.pubkey}-nsecbunker`);
// logout
await db.accountLogout();
await ark.logout();
// clear cache
queryClient.clear();