ancora parte 3

This commit is contained in:
Surya Paolo
2025-12-24 19:46:49 +01:00
parent 11c17bdd8e
commit cd123ac363
17 changed files with 683 additions and 166 deletions

View File

@@ -245,6 +245,7 @@ import { defineComponent, ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useQuasar, date as qdate } from 'quasar';
import { Api } from '@api';
import { useAuth } from '../composables/useAuth';
interface FeedbackStats {
averageRating: number;
@@ -298,6 +299,10 @@ export default defineComponent({
const currentPage = ref(1);
const hasMore = ref(false);
const { user: currentUser } = useAuth();
const currentUserId = computed(() => currentUser.value?._id);
// Computed
const filteredFeedbacks = computed(() => {
return activeTab.value === 'received'
@@ -360,9 +365,9 @@ export default defineComponent({
try {
const [statsRes, receivedRes, givenRes] = await Promise.all([
Api.SendReqWithData('/api/viaggi/feedback/stats', 'GET'),
Api.SendReqWithData('/api/viaggi/feedback/received', 'GET'),
Api.SendReqWithData('/api/viaggi/feedback/given', 'GET')
Api.SendReqWithData('/api/viaggi/feedback/user/' + currentUserId.value + '/stats', 'GET'),
Api.SendReqWithData('/api/viaggi/feedback/my/received', 'GET'),
Api.SendReqWithData('/api/viaggi/feedback/my/given', 'GET')
]);
if (statsRes.success) {
@@ -393,8 +398,8 @@ export default defineComponent({
try {
const endpoint = activeTab.value === 'received'
? '/api/viaggi/feedback/received'
: '/api/viaggi/feedback/given';
? '/api/viaggi/feedback/my/received'
: '/api/viaggi/feedback/my/given';
const response = await Api.SendReqWithData(`${endpoint}?page=${currentPage.value}`, 'GET');