mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34: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;
 | 
						selectedUser.value = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (userId) {
 | 
						if (userId) {
 | 
				
			||||||
		// Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination.
 | 
							await Promise.all([
 | 
				
			||||||
		// Otherwise, the page appears to load "backwards".
 | 
								// Wait for 1 second to match the animation effects in MkHorizontalSwipe, MkPullToRefresh, and MkPagination.
 | 
				
			||||||
		await new Promise(resolve => setTimeout(resolve, 1000));
 | 
								// Otherwise, the page appears to load "backwards".
 | 
				
			||||||
 | 
								new Promise(resolve => setTimeout(resolve, 1000)),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// We need a User entity, but the pagination returns only UserLite.
 | 
								// We need a User entity, but the pagination returns only UserLite.
 | 
				
			||||||
		// An additional request is needed to "upgrade" the object.
 | 
								// An additional request is needed to "upgrade" the object.
 | 
				
			||||||
		await misskeyApi('users/show', { userId })
 | 
								misskeyApi('users/show', { userId })
 | 
				
			||||||
			.then(user => selectedUser.value = user)
 | 
									.then(user => selectedUser.value = user)
 | 
				
			||||||
			.catch(error => {
 | 
									.catch(error => {
 | 
				
			||||||
				console.error('Error fetching user info', error);
 | 
										console.error('Error fetching user info', error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				return selectedUserError.value =
 | 
										return selectedUserError.value =
 | 
				
			||||||
					typeof(error) === 'string'
 | 
											typeof(error) === 'string'
 | 
				
			||||||
						? String(error)
 | 
												? String(error)
 | 
				
			||||||
						: JSON.stringify(error);
 | 
												: JSON.stringify(error);
 | 
				
			||||||
			});
 | 
									}),
 | 
				
			||||||
 | 
							]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue