This commit is contained in:
vadim committed 2026-09-28 17:44:39 +03:00
1 parent 3082794436
commit 67d30a6f32
4 files changed
+16 -7

No files matched your search

+6 -2
View File
@@ -1,13 +1,17 @@
<script setup lang="ts">
import { useEventSource } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { computed, onMounted, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useStatusStore } from '@/stores/status.ts'
import { useIssueStore } from '@/stores/issue.ts'
import { useProjectStore } from '@/stores/project.ts'
const route = useRoute()
const issueStore = useIssueStore()
const statusStore = useStatusStore()
const projectStore = useProjectStore()
const { currentProjectId } = storeToRefs(projectStore)
interface IssueSseEvent {
type: string
@@ -35,7 +39,7 @@ watch(data, () => {
data.value?.type === 'issue.updated' ||
data.value?.type === 'issue.deleted'
) {
issueStore.getStat()
issueStore.getStat(currentProjectId.value)
}
})
@@ -46,7 +50,7 @@ const layout = computed(() => {
onMounted(async () => {
await statusStore.list()
await issueStore.getStat()
await issueStore.getStat(currentProjectId.value)
})
</script>
+3 -2
View File
@@ -84,6 +84,7 @@ export async function itemDelete(id: number) {
return true
}
export async function itemStat() {
return apiClient.get<IssueStat>('/api/issues/stats')
export async function itemStat(projectId?: string) {
const query = toQuery({ projectId: projectId })
return apiClient.get<IssueStat>(`/api/issues/stats${query}`)
}
+2 -2
View File
@@ -75,9 +75,9 @@ export const useIssueStore = defineStore('item', () => {
}
}
async function getStat(): Promise<IssueStat | undefined> {
async function getStat(projectId?: string | null): Promise<IssueStat | undefined> {
try {
stats.value = await itemStat()
stats.value = await itemStat(projectId ?? undefined)
return stats.value
} catch (e) {
+5 -1
View File
@@ -83,9 +83,13 @@ watch(currentProjectId, async () => {
clearBatch()
close()
await load()
await issueStore.getStat(currentProjectId.value)
})
onMounted(async () => await load())
onMounted(async () => {
await load()
await issueStore.getStat(currentProjectId.value)
})
const gridTemplate = computed(() => (selected.value.length ? '1fr 1fr' : '1fr'))
const goToIssue = (key: string[]) => router.push(`/issues/${key[0]}`)