this repo has no description
at main 29 lines 732 B view raw
1/** 2 * Defines a route based on a given default route and 3 * otherwise falls back to the base storefront path 4 * 5 * @param defaultRoute - ie 'browse', 'listen-now', or empty string 6 * @param storefront - storefront id ie 'us' 7 * @param language - language tag ie 'en-US' 8 * @returns route - ie /us/browse?l=es-MX 9 */ 10export function getStorefrontRoute( 11 defaultRoute: string, 12 storefront: string, 13 language?: string, 14): string { 15 let route; 16 17 if (defaultRoute === '') { 18 route = `/${storefront}`; 19 } else { 20 route = `/${storefront}/${defaultRoute}`; 21 } 22 23 // add optional language tag if that is passed in 24 if (language) { 25 route = `${route}?l=${language}`; 26 } 27 28 return route; 29}