frontend/src/views/ChartsView.vue

44 lines
1,005 B
Vue
Raw Normal View History

2025-09-24 21:31:20 +03:00
<script setup>
import { onMounted, ref } from 'vue'
import { useChartsApi } from '@/api/charts.js'
import ChartsCard from '@/views/ChartsView/ChartsCard.vue'
2025-09-12 20:23:58 +03:00
2025-09-24 21:31:20 +03:00
const { getChartsPrices } = useChartsApi()
const pricesList = ref(null)
const loading = ref(true)
const error = ref(null)
const fetchPrices = async () => {
try {
const response = await getChartsPrices(7)
pricesList.value = response.data
if (!response.status === 400) {
router.push({ name: 'collection' })
}
} catch (err) {
error.value = err.message
} finally {
loading.value = false
}
}
onMounted(() => {
fetchPrices()
})
2025-09-12 20:23:58 +03:00
</script>
<template>
2025-09-24 21:31:20 +03:00
<n-grid responsive="screen" cols="1 s:1 m:2 l:2 xl:2 2xl:2" class="grid-main">
<n-gi class="grid-item" v-for="item in pricesList" :key="item.merch_uuid">
<router-link :to="`/details/${item.merch_uuid}`" class="card-link">
<ChartsCard :chartsData="item" />
</router-link>
</n-gi>
</n-grid>
2025-09-12 20:23:58 +03:00
</template>
<style scoped>
</style>