mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-01 17:31:13 +00:00
Modify profile loading
This commit is contained in:
parent
914a8ec866
commit
a12bfc573d
@ -439,6 +439,14 @@ export function AccountProvider(props: { children: JSXElement }) {
|
|||||||
|
|
||||||
if (storedKey) {
|
if (storedKey) {
|
||||||
setPublicKey(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) {
|
if (nostr === undefined) {
|
||||||
@ -477,7 +485,6 @@ export function AccountProvider(props: { children: JSXElement }) {
|
|||||||
else {
|
else {
|
||||||
if (key !== storedKey) {
|
if (key !== storedKey) {
|
||||||
setPublicKey(key);
|
setPublicKey(key);
|
||||||
}
|
|
||||||
|
|
||||||
// Read profile from storage
|
// Read profile from storage
|
||||||
const storedUser = getStoredProfile(key);
|
const storedUser = getStoredProfile(key);
|
||||||
@ -486,6 +493,7 @@ export function AccountProvider(props: { children: JSXElement }) {
|
|||||||
// If it exists, set it as active user
|
// If it exists, set it as active user
|
||||||
updateStore('activeUser', () => ({...storedUser}));
|
updateStore('activeUser', () => ({...storedUser}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch it anyway, maybe there is an update
|
// Fetch it anyway, maybe there is an update
|
||||||
getUserProfiles([key], `user_profile_${APP_ID}`);
|
getUserProfiles([key], `user_profile_${APP_ID}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user