Files
mohadese namavar ec84dfd222 init git
2024-06-16 00:22:14 +04:30

49 lines
1.2 KiB
Vue

<template>
<NuxtLayout :name="device" :config="config">
<main class="panel-notifications">
<ul>
<li v-for="(item, i) in items" :key="i">
<PanelNotificationItem :data="item" />
</li>
</ul>
<AppPagination :pages="pages" />
</main>
</NuxtLayout>
</template>
<script setup>
const { device, t } = inject('service')
const config = reactive({
desktop: { toolbar: true }, mobile: { header: { back: true, title: t('notifications') } },
})
const items = ref([])
const pages = ref(1)
const { meta, query } = useRoute()
const { page = 1 } = query
const { status, data, error } = await useFetch(`/api/users/current/notif/${page}`, {
headers: {
Authorization: useCookie('token')
}
})
if (status.value == 'success') {
items.value = data.value.notifications
pages.value = data.value.pages
} else throw createError(error.value)
</script>
<style lang="scss">
.panel-notifications {
@apply container w-full flex flex-col items-center max-lg:px-6 max-lg:gap-4;
@apply pt-8 pb-20 lg:pt-14 lg:pb-[7.5rem] max-lg:overflow-hidden;
&>ul {
@apply w-full flex flex-col gap-4;
}
}
</style>