mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	fetch user info during animation sync
This commit is contained in:
		
							parent
							
								
									9b572be0df
								
							
						
					
					
						commit
						2fbb697bf9
					
				
					 1 changed files with 16 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -114,22 +114,24 @@ async function showUserNotes(userId: string): Promise<void> {
 | 
			
		|||
	selectedUser.value = null;
 | 
			
		||||
 | 
			
		||||
	if (userId) {
 | 
			
		||||
		// Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination.
 | 
			
		||||
		// Otherwise, the page appears to load "backwards".
 | 
			
		||||
		await new Promise(resolve => setTimeout(resolve, 1000));
 | 
			
		||||
		await Promise.all([
 | 
			
		||||
			// Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination.
 | 
			
		||||
			// Otherwise, the page appears to load "backwards".
 | 
			
		||||
			new Promise(resolve => setTimeout(resolve, 1000)),
 | 
			
		||||
 | 
			
		||||
		// We need a User entity, but the pagination returns only UserLite.
 | 
			
		||||
		// An additional request is needed to "upgrade" the object.
 | 
			
		||||
		await misskeyApi('users/show', { userId })
 | 
			
		||||
			.then(user => selectedUser.value = user)
 | 
			
		||||
			.catch(error => {
 | 
			
		||||
				console.error('Error fetching user info', error);
 | 
			
		||||
			// We need a User entity, but the pagination returns only UserLite.
 | 
			
		||||
			// An additional request is needed to "upgrade" the object.
 | 
			
		||||
			misskeyApi('users/show', { userId })
 | 
			
		||||
				.then(user => selectedUser.value = user)
 | 
			
		||||
				.catch(error => {
 | 
			
		||||
					console.error('Error fetching user info', error);
 | 
			
		||||
 | 
			
		||||
				return selectedUserError.value =
 | 
			
		||||
					typeof(error) === 'string'
 | 
			
		||||
						? String(error)
 | 
			
		||||
						: JSON.stringify(error);
 | 
			
		||||
			});
 | 
			
		||||
					return selectedUserError.value =
 | 
			
		||||
						typeof(error) === 'string'
 | 
			
		||||
							? String(error)
 | 
			
		||||
							: JSON.stringify(error);
 | 
			
		||||
				}),
 | 
			
		||||
		]);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue