-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.ts
34 lines (29 loc) · 1.51 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { StorefrontModule } from '@vue-storefront/core/lib/modules'
import { getSearchAdapter } from '@vue-storefront/core/lib/search/adapter/searchAdapterFactory'
import { faqModule } from './state'
export const KEY = 'amasty-faq'
const KnowledgeBase = () => import(/* webpackChunkName: "vsf-faq-page" */ './pages/KnowledgeBase.vue')
const KnowledgeBaseCategory = () => import(/* webpackChunkName: "vsf-faq-category-page" */ './pages/KnowledgeBaseCategory.vue')
const KnowledgeBaseQuestion = () => import(/* webpackChunkName: "vsf-faq-question-page" */ './pages/KnowledgeBaseQuestion.vue')
export const AmastyFaq: StorefrontModule = function ({ store, router }) {
store.registerModule(KEY, faqModule)
router.addRoutes([
{ name: 'amasty-faq', path: '/knowledge-base', component: KnowledgeBase },
{ name: 'amasty-faq-category', path: '/knowledge-base/:slug', component: KnowledgeBaseCategory },
{ name: 'amasty-faq-question', path: '/knowledge-base/:slug/:question', component: KnowledgeBaseQuestion }
])
getSearchAdapter().then((searchAdapter) => {
searchAdapter.registerEntityType('faq_question', {
queryProcessor: (query) => query,
resultProcessor: (resp, start, size) => {
return searchAdapter.handleResult(resp, 'faq_question', start, size)
}
})
searchAdapter.registerEntityType('faq_category', {
queryProcessor: (query) => query,
resultProcessor: (resp, start, size) => {
return searchAdapter.handleResult(resp, 'faq_category', start, size)
}
})
})
}