refactor: update data receive from backend
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
This commit is contained in:
parent
9c04b20992
commit
80cb67323b
2 changed files with 11 additions and 37 deletions
|
|
@ -18,6 +18,7 @@ import { useNavigator } from 'src/stores/navigator';
|
||||||
import { initLang, initTheme, Lang, setLang } from 'src/utils/ui';
|
import { initLang, initTheme, Lang, setLang } from 'src/utils/ui';
|
||||||
import { baseUrl } from 'stores/utils';
|
import { baseUrl } from 'stores/utils';
|
||||||
import { useNotification } from 'src/stores/notification';
|
import { useNotification } from 'src/stores/notification';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
const useMyBranch = useMyBranchStore();
|
const useMyBranch = useMyBranchStore();
|
||||||
const { fetchListMyBranch } = useMyBranch;
|
const { fetchListMyBranch } = useMyBranch;
|
||||||
|
|
@ -28,13 +29,6 @@ interface NotificationButton {
|
||||||
active: boolean;
|
active: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Notification {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
read: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const loaderStore = useLoader();
|
const loaderStore = useLoader();
|
||||||
const navigatorStore = useNavigator();
|
const navigatorStore = useNavigator();
|
||||||
|
|
@ -82,20 +76,6 @@ const notiMenu = ref<NotificationButton[]>([
|
||||||
active: false,
|
active: false,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const notification = ref<Notification[]>([
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
title: 'Unread',
|
|
||||||
content: 'Unread',
|
|
||||||
read: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
title: 'Read',
|
|
||||||
content: 'Already read',
|
|
||||||
read: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
function setActive(button: NotificationButton) {
|
function setActive(button: NotificationButton) {
|
||||||
notiMenu.value = notiMenu.value.map((current) => ({
|
notiMenu.value = notiMenu.value.map((current) => ({
|
||||||
|
|
@ -290,7 +270,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
<div class="row q-gutter-x-md items-center" style="margin-left: auto">
|
<div class="row q-gutter-x-md items-center" style="margin-left: auto">
|
||||||
<!-- notification -->
|
<!-- notification -->
|
||||||
<!-- <q-btn
|
<q-btn
|
||||||
round
|
round
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
|
|
@ -329,7 +309,7 @@ onMounted(async () => {
|
||||||
@click="setActive(btn)"
|
@click="setActive(btn)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<q-infinite-scroll :offset="250">
|
<div style="max-height: 30vh; overflow-y: auto">
|
||||||
<div class="caption cursor-pointer">
|
<div class="caption cursor-pointer">
|
||||||
<q-item
|
<q-item
|
||||||
dense
|
dense
|
||||||
|
|
@ -337,8 +317,9 @@ onMounted(async () => {
|
||||||
class="q-py-sm"
|
class="q-py-sm"
|
||||||
v-ripple
|
v-ripple
|
||||||
v-for="(item, i) in !filterUnread
|
v-for="(item, i) in !filterUnread
|
||||||
? notificationData
|
? notificationData.filter((v) => !v.read)
|
||||||
: notificationData"
|
: notificationData.filter((v) => v.read)"
|
||||||
|
@click="notificationStore.getNotification(item.id)"
|
||||||
:key="i"
|
:key="i"
|
||||||
>
|
>
|
||||||
<q-avatar
|
<q-avatar
|
||||||
|
|
@ -372,17 +353,9 @@ onMounted(async () => {
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-item>
|
</q-item>
|
||||||
</div>
|
</div>
|
||||||
<template v-slot:loading>
|
</div>
|
||||||
<div
|
|
||||||
class="text-center q-my-md"
|
|
||||||
v-if="noti && noti?.result.length < noti?.total"
|
|
||||||
>
|
|
||||||
<q-spinner-dots color="primary" size="40px" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</q-infinite-scroll>
|
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-btn> -->
|
</q-btn>
|
||||||
|
|
||||||
<!-- เปลี่นนภาษา -->
|
<!-- เปลี่นนภาษา -->
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,11 @@ import { PaginationResult } from 'src/types';
|
||||||
import { createDataRefBase } from '../utils';
|
import { createDataRefBase } from '../utils';
|
||||||
|
|
||||||
export type Notification = {
|
export type Notification = {
|
||||||
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
detail: string;
|
detail: string;
|
||||||
receiverId?: string;
|
read?: boolean;
|
||||||
groupId?: string[];
|
createdAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useNotification = defineStore('noti-store', () => {
|
export const useNotification = defineStore('noti-store', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue