fix(pages): redirect to homepage if user isn't found from api
This commit is contained in:
		
							parent
							
								
									40bb98eb1d
								
							
						
					
					
						commit
						09762a7efb
					
				| @ -10,7 +10,7 @@ | |||||||
| 	const { data: ses } = useAuth(); | 	const { data: ses } = useAuth(); | ||||||
| 
 | 
 | ||||||
| 	const { data: userInfo } = await useApiFetch<IUser | null>(`/user/${rtr.params.id}`); | 	const { data: userInfo } = await useApiFetch<IUser | null>(`/user/${rtr.params.id}`); | ||||||
| 	if (userInfo === null) { | 	if (userInfo.value === null) { | ||||||
| 		navigateTo("/"); | 		navigateTo("/"); | ||||||
| 	} | 	} | ||||||
| 	const activeKey = ref("main"); | 	const activeKey = ref("main"); | ||||||
| @ -49,9 +49,9 @@ | |||||||
| 				</div> | 				</div> | ||||||
| 				<div v-else> | 				<div v-else> | ||||||
| 					<span> | 					<span> | ||||||
| 						{{ format(uLastVisit, "MM/dd/yyyy @ hh:mm:ss a") }} | 						{{ format(userInfo.lastVisit, "MM/dd/yyyy @ hh:mm:ss a") }} | ||||||
| 					</span> | 					</span> | ||||||
| 					<span style="margin-left: 0.6em"> ({{ formatDistanceToNow(uLastVisit, { addSuffix: true }) }}) </span> | 					<span style="margin-left: 0.6em"> ({{ formatDistanceToNow(userInfo.lastVisit, { addSuffix: true }) }}) </span> | ||||||
| 				</div> | 				</div> | ||||||
| 			</a-descriptions-item> | 			</a-descriptions-item> | ||||||
| 			<a-descriptions-item label="Website"> | 			<a-descriptions-item label="Website"> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user