Обновил боковое меню для динамического отображения групп

This commit is contained in:
Ilia Miheev
2026-06-03 20:17:35 +03:00
parent c2d8bbad8d
commit 7a37170b0a
7 changed files with 215 additions and 216 deletions
+3 -23
View File
@@ -1,31 +1,11 @@
import { ref } from 'vue'
import partsItems from '@/data/parts.js'
const parts = ref([])
let loadPromise = null
const parts = ref([...partsItems])
export function usePartsCatalog() {
async function loadParts() {
if (parts.value.length) {
return parts.value
}
if (!loadPromise) {
loadPromise = fetch('/droneComponents/components.json')
.then((response) => (response.ok ? response.json() : []))
.then((data) => {
parts.value = data
return data
})
.catch(() => {
parts.value = []
return []
})
.finally(() => {
loadPromise = null
})
}
return loadPromise
return parts.value
}
function getPartById(id) {