modified: main_dc/yalarba/easySite/easySite/app/composables/useObjects.ts
modified: main_dc/yalarba/easySite/easySite/app/plugins/theme.client.ts delete files
This commit is contained in:
@@ -1,39 +0,0 @@
|
|||||||
// В файле composables/useObjects.ts обновляем fetchObjects:
|
|
||||||
|
|
||||||
const fetchObjects = async (filters?: any): Promise<ObjectItem[]> => {
|
|
||||||
loading.value = true
|
|
||||||
error.value = null
|
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
let filteredObjects = [...mockObjects]
|
|
||||||
|
|
||||||
// Применяем фильтры
|
|
||||||
if (filters) {
|
|
||||||
if (filters.search) {
|
|
||||||
const searchTerm = filters.search.toLowerCase()
|
|
||||||
filteredObjects = filteredObjects.filter(obj =>
|
|
||||||
obj.title.toLowerCase().includes(searchTerm) ||
|
|
||||||
obj.city.toLowerCase().includes(searchTerm) ||
|
|
||||||
obj.description.toLowerCase().includes(searchTerm)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (filters.type) {
|
|
||||||
filteredObjects = filteredObjects.filter(obj => obj.type === filters.type)
|
|
||||||
}
|
|
||||||
if (filters.city) {
|
|
||||||
filteredObjects = filteredObjects.filter(obj =>
|
|
||||||
obj.city.toLowerCase().includes(filters.city.toLowerCase())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (filters.userId) {
|
|
||||||
filteredObjects = filteredObjects.filter(obj => obj.userId === filters.userId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
objects.value = filteredObjects
|
|
||||||
loading.value = false
|
|
||||||
resolve(filteredObjects)
|
|
||||||
}, 500)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user