mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
Add Nostr login info to context
This commit is contained in:
2 files changed
+32
-1
No files matched your search
@@ -5,7 +5,7 @@ import { NLogin, useNostrLogin } from '@nostrify/react/login';
|
||||
|
||||
export function useLoginActions() {
|
||||
const { nostr } = useNostr();
|
||||
const { addLogin } = useNostrLogin();
|
||||
const { logins, addLogin, removeLogin } = useNostrLogin();
|
||||
|
||||
return {
|
||||
// Login with a Nostr secret key
|
||||
@@ -23,5 +23,12 @@ export function useLoginActions() {
|
||||
const login = await NLogin.fromExtension();
|
||||
addLogin(login);
|
||||
},
|
||||
// Log out the current user
|
||||
async logout(): Promise<void> {
|
||||
const login = logins[0];
|
||||
if (login) {
|
||||
removeLogin(login.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user