Modify profile loading

This commit is contained in:
Bojan Mojsilovic 2024-04-25 12:38:15 +02:00
parent 914a8ec866
commit a12bfc573d
1 changed files with 14 additions and 6 deletions

View File

@ -439,6 +439,14 @@ export function AccountProvider(props: { children: JSXElement }) {
if (storedKey) {
setPublicKey(storedKey);
// Read profile from storage
const storedUser = getStoredProfile(storedKey);
if (storedUser) {
// If it exists, set it as active user
updateStore('activeUser', () => ({...storedUser}));
}
}
if (nostr === undefined) {
@ -477,14 +485,14 @@ export function AccountProvider(props: { children: JSXElement }) {
else {
if (key !== storedKey) {
setPublicKey(key);
}
// Read profile from storage
const storedUser = getStoredProfile(key);
// Read profile from storage
const storedUser = getStoredProfile(key);
if (storedUser) {
// If it exists, set it as active user
updateStore('activeUser', () => ({...storedUser}));
if (storedUser) {
// If it exists, set it as active user
updateStore('activeUser', () => ({...storedUser}));
}
}
// Fetch it anyway, maybe there is an update