Function getPWARoute

  • Extracts the PWA route from a given route string.

    This function checks if the provided route string is a PWA route and, if so, extracts and returns the part of the route after the 'pwa:' prefix. If the route is not a PWA route, it returns an empty string.

    Parameters

    • route: string

      The route string to be processed.

    Returns string

    The extracted PWA route if the input is a PWA route, otherwise an empty string.

    const route = 'pwa:/home';
    const pwaRoute = getPWARoute(route);
    console.log(pwaRoute); // Output: '/home'

    const nonPwaRoute = 'web:/home';
    const result = getPWARoute(nonPwaRoute);
    console.log(result); // Output: ''