update splash screen

This commit is contained in:
Ren Amamiya
2023-08-11 11:55:31 +07:00
parent f2fc41018d
commit 0cfc3a48d8
7 changed files with 244 additions and 91 deletions

View File

@@ -9,6 +9,7 @@ export function useAccount() {
['currentAccount'],
async () => {
const account = await getActiveAccount();
console.log('active account: ', account);
if (account?.pubkey) {
const user = ndk.getUser({ hexpubkey: account?.pubkey });
await user.fetchProfile();
@@ -17,6 +18,7 @@ export function useAccount() {
return account;
},
{
enabled: !!ndk,
staleTime: Infinity,
refetchOnMount: false,
refetchOnWindowFocus: false,

View File

@@ -70,6 +70,8 @@ export function useNostr() {
async function fetchNotes(prevFollow?: string[]) {
try {
if (!ndk) return { status: 'failed', message: 'NDK instance not found' };
const network = await fetchNetwork(prevFollow);
const totalNotes = await countTotalNotes();
const lastLogin = await getLastLogin();
@@ -112,6 +114,8 @@ export function useNostr() {
async function fetchChats() {
try {
if (!ndk) return { status: 'failed', message: 'NDK instance not found' };
const lastLogin = await getLastLogin();
const incomingMessages = await fetcher.fetchAllEvents(
relayUrls,