Skip to content

alisdev/vsf-mapping-fallback

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

Modular mapping fallback for Vue Storefront

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%