-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
30 lines (27 loc) · 1.07 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
import { StorefrontModule } from '@vue-storefront/core/lib/modules'
import { getSearchAdapter } from '@vue-storefront/core/lib/search/adapter/searchAdapterFactory'
import { blogModule } from './state'
export const KEY = 'aheadworks-blog'
export const AheadworksBlog: StorefrontModule = function ({ app, store }) {
store.registerModule(KEY, blogModule)
getSearchAdapter().then((searchAdapter) => {
searchAdapter.registerEntityType('cms_blog', {
queryProcessor: (query) => {
// function that can modify the query each time before it's being executed
return query
},
resultProcessor: (resp, start, size) => {
return searchAdapter.handleResult(resp, 'cms_blog', start, size)
}
})
searchAdapter.registerEntityType('cms_blog_category', {
queryProcessor: (query) => {
// function that can modify the query each time before it's being executed
return query
},
resultProcessor: (resp, start, size) => {
return searchAdapter.handleResult(resp, 'cms_blog_category', start, size)
}
})
})
}