ancora parte 3
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user