github.com/manicqin/nomad@v0.9.5/ui/app/utils/add-to-path.js (about)

     1  // Adds a string to the end of a URL path while being mindful of query params
     2  export default function addToPath(url, extension = '') {
     3    const [path, params] = url.split('?');
     4    let newUrl = `${path}${extension}`;
     5  
     6    if (params) {
     7      newUrl += `?${params}`;
     8    }
     9  
    10    return newUrl;
    11  }