fix(pages): bands page bug
fix error being thrown for unauthenticated users because of null value
This commit is contained in:
		
							parent
							
								
									2dde6c381b
								
							
						
					
					
						commit
						f0b107c2fd
					
				| @ -1,8 +1,7 @@ | |||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| 	import { IBand } from "@models/band"; | 	import { IBand } from "@models/band"; | ||||||
| 	import icon from "~/components/icon.vue"; | 	import icon from "~/components/icon.vue"; | ||||||
| 	import { subscriptions, bp } from "@client/listActions"; | 	import { subscriptions } from "@client/listActions"; | ||||||
| 	import { IUser } from "@models/user"; |  | ||||||
| 
 | 
 | ||||||
| 	const { data: bands } = (await useApiFetch<NonNullable<IBand[]>>("/band/all")) as unknown as { data: Ref<IBand[]> }; | 	const { data: bands } = (await useApiFetch<NonNullable<IBand[]>>("/band/all")) as unknown as { data: Ref<IBand[]> }; | ||||||
| 
 | 
 | ||||||
| @ -25,7 +24,7 @@ | |||||||
| 	}); | 	}); | ||||||
| </script> | </script> | ||||||
| <template> | <template> | ||||||
| 	<a-list v-model:data-source="bands" :grid="bp"> | 	<a-list v-model:data-source="bands" :grid="{ gutter: 5, sm: 1, md: 3, lg: 4, xl: 5, xxl: 6 }"> | ||||||
| 		<template #renderItem="{ item }"> | 		<template #renderItem="{ item }"> | ||||||
| 			<a-list-item :key="item._id + inc"> | 			<a-list-item :key="item._id + inc"> | ||||||
| 				<a-row :gutter="[5, 5]"> | 				<a-row :gutter="[5, 5]"> | ||||||
| @ -35,7 +34,7 @@ | |||||||
| 						</nuxt-link> | 						</nuxt-link> | ||||||
| 					</a-col> | 					</a-col> | ||||||
| 					<!-- subscribe... --> | 					<!-- subscribe... --> | ||||||
| 					<a-col v-if="data && data.user?._id" style="margin-left: auto"> | 					<a-col v-if="data && data?.user?._id" style="margin-left: auto"> | ||||||
| 						<a | 						<a | ||||||
| 							v-if="!data?.user.subscriptions.bands.includes(item._id)" | 							v-if="!data?.user.subscriptions.bands.includes(item._id)" | ||||||
| 							@click=" | 							@click=" | ||||||
| @ -59,7 +58,7 @@ | |||||||
| 							<icon :istyle="'regular'" name="x" :size="12" /> | 							<icon :istyle="'regular'" name="x" :size="12" /> | ||||||
| 						</a> | 						</a> | ||||||
| 					</a-col> | 					</a-col> | ||||||
| 					<a-col v-if="data?.user._id"> | 					<a-col v-if="data?.user?._id"> | ||||||
| 						<a | 						<a | ||||||
| 							@click=" | 							@click=" | ||||||
| 								async (e) => { | 								async (e) => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user