Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Nordicwebteamvue/vsf-mapping-fallback
Modular mapping fallback for Vue Storefront
https://github.com/Nordicwebteamvue/vsf-mapping-fallback
Last synced: 3 months ago
JSON representation
Modular mapping fallback for Vue Storefront
- Host: GitHub
- URL: https://github.com/Nordicwebteamvue/vsf-mapping-fallback
- Owner: Nordicwebteamvue
- Created: 2019-06-13T00:19:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-19T15:51:22.000Z (about 4 years ago)
- Last Synced: 2024-05-22T17:34:10.602Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 8.79 KB
- Stars: 7
- Watchers: 3
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-vuestorefront - URL Mapping fallback
README
# vsf-mapping-fallback
Modular mapping fallback for Vue Storefront.
https://docs.vuestorefront.io/guide/basics/url.html#how-to-customize-the-mapping-mechanism
## Usage
Clone this repository to `src/modules/vsf-mapping-fallback` and use it like below
```js
import { extendMappingFallback, Payload } from 'src/modules/vsf-mapping-fallback'
import { forProduct, forCategory, tap } from 'src/modules/vsf-mapping-fallback/builtin'
import { forStoryblok } from './vsf-storyblok-module/mappingFallback'export const forDemo = async (context, { url, params }: Payload) => {
if (url === 'demo') {
return {
name: 'category',
redirect: '/posters'
}
}
}const extendUrlModule = extendMappingFallback(
forDemo, forProduct, forCategory, forStoryblok, tap
)export function registerClientModules () {
registerModule(UrlModule)
registerModule(extendUrlModule)
...
}
```## Builtins
### `forProduct`
The default mappingFallback for products
### `forCategory`
The default mappingFallback for categories
### `tap`
Prints payload to console