8/7/405
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { fetchBanners, type AppBannerDto } from '@/services/agentApi'
|
||||
|
||||
export function useSlotBanners(slot: string) {
|
||||
const banners = ref<AppBannerDto[]>([])
|
||||
const loading = ref(true)
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
banners.value = await fetchBanners(slot)
|
||||
} catch {
|
||||
banners.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
|
||||
return { banners, loading, reload: load }
|
||||
}
|
||||
Reference in New Issue
Block a user