Main page shows hero, redirects to /catalog on first selection
Some checks failed
Build Docker Image / build (push) Has been cancelled

This commit is contained in:
Ruslan Bakiev
2026-01-22 11:08:57 +07:00
parent d837b9b90b
commit 166c404ff6
2 changed files with 54 additions and 7 deletions

View File

@@ -157,6 +157,13 @@ export function useCatalogSearch() {
return 'hero'
})
// Check if we're on the main page (not /catalog)
const localePath = useLocalePath()
const isMainPage = computed(() => {
const catalogPath = localePath('/catalog')
return !route.path.startsWith(catalogPath)
})
// Navigation helpers
const updateQuery = (updates: Partial<LocationQuery>) => {
const newQuery = { ...route.query }
@@ -169,7 +176,12 @@ export function useCatalogSearch() {
}
})
router.push({ query: newQuery })
// If on main page and adding filters, navigate to /catalog
if (isMainPage.value && Object.keys(newQuery).length > 0) {
router.push({ path: localePath('/catalog'), query: newQuery })
} else {
router.push({ query: newQuery })
}
}
const startSelect = (type: SelectMode) => {
@@ -197,7 +209,11 @@ export function useCatalogSearch() {
}
const clearAll = () => {
router.push({ query: {} })
if (isMainPage.value) {
router.push({ path: localePath('/catalog'), query: {} })
} else {
router.push({ query: {} })
}
}
// Text search (for filtering within current grid)