diff --git a/src/components/ui/AvatarPicture.vue b/src/components/ui/AvatarPicture.vue index a28a660c2..127bc8970 100644 --- a/src/components/ui/AvatarPicture.vue +++ b/src/components/ui/AvatarPicture.vue @@ -8,7 +8,7 @@ const session = useSession(); const token = session.getToken(); - diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue index 21c56b0b3..c05ecdecf 100644 --- a/src/components/ui/VnNotes.vue +++ b/src/components/ui/VnNotes.vue @@ -4,8 +4,8 @@ import AvatarPicture from 'src/components/ui/AvatarPicture.vue'; import { toDateHour } from 'src/filters'; import { ref } from 'vue'; import axios from 'axios'; -import FetchData from 'components/FetchData.vue'; import { useI18n } from 'vue-i18n'; +import VnPaginate from './VnPaginate.vue'; const $props = defineProps({ id: { type: String, required: true }, @@ -15,36 +15,75 @@ const $props = defineProps({ addNote: { type: Boolean, default: false }, }); const { t } = useI18n(); -const notes = ref([]); const noteModal = ref(false); const newNote = ref(''); -const claimObservationRef = ref(); - -function setNotes(data) { - notes.value = data; -} +const vnPaginateRef = ref(); async function fetch() { const body = $props.body; Object.assign(body, { text: newNote.value }); await axios.post($props.url, body); - claimObservationRef.value.fetch(); + vnPaginateRef.value.fetch(); } diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 2a5b878f5..434ebf232 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -49,6 +49,7 @@ const props = defineProps({ }); const emit = defineEmits(['onFetch', 'onPaginate']); +defineExpose({ fetch }); const isLoading = ref(false); const pagination = ref({ sortBy: props.order, @@ -82,7 +83,6 @@ async function fetch() { if (!arrayData.hasMoreData.value) { isLoading.value = false; } - emit('onFetch', store.data); } diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue index c79c9e486..6c8361fde 100644 --- a/src/pages/Claim/Card/ClaimNotes.vue +++ b/src/pages/Claim/Card/ClaimNotes.vue @@ -9,7 +9,6 @@ const user = state.getUser(); const id = route.params.id; const claimFilter = { - order: 'created DESC', where: { claimFk: id }, fields: ['created', 'workerFk', 'text'], include: { @@ -38,7 +37,6 @@ const body = {