fix: course and bath category filter issue

This commit is contained in:
Jannat Patel
2026-01-19 12:38:12 +05:30
parent c97a5e813c
commit 0883aedc1d
4 changed files with 22 additions and 29 deletions

View File

@@ -130,7 +130,6 @@
import {
Breadcrumbs,
Button,
call,
createListResource,
Dropdown,
FormControl,
@@ -185,24 +184,27 @@ const batches = createListResource({
cache: ['batches', user.data?.name],
pageLength: pageLength.value,
start: start.value,
onSuccess(data) {
let allCategories = data.map((batch) => batch.category)
allCategories = allCategories.filter(
(category, index) => allCategories.indexOf(category) === index && category
)
if (categories.value.length <= allCategories.length) {
updateCategories(data)
}
},
})
const setCategories = (data) => {
let allCategories = data.map((batch) => batch.category)
allCategories = allCategories.filter(
(category, index) => allCategories.indexOf(category) === index && category
)
if (categories.value.length <= allCategories.length) {
updateCategories(data)
}
}
const updateBatches = () => {
updateFilters()
batches.update({
filters: filters.value,
orderBy: orderBy.value,
})
batches.reload()
batches.reload().then((data) => {
setCategories(data)
})
}
const updateFilters = () => {

View File

@@ -168,9 +168,6 @@ const courses = createListResource({
cache: ['courses', user.data?.name],
pageLength: pageLength.value,
start: start.value,
onSuccess(data) {
setCategories(data)
},
})
const setCategories = (data) => {
@@ -219,7 +216,9 @@ const updateCourses = () => {
courses.update({
filters: filters.value,
})
courses.reload()
courses.reload().then((data) => {
setCategories(data)
})
}
const updateFilters = () => {