Files
coriolis/src/app/utils/UrlGenerators.js
2016-11-21 10:06:14 +00:00

24 lines
556 B
JavaScript

/**
* Generates a URL for the outiffing page
* @param {String} shipId Ship Id
* @param {String} code [optional] Serliazed build code
* @param {String} buildName [optional] Build name
* @return {String} URL
*/
export function outfitURL(shipId, code, buildName) {
let path = '/outfit/' + shipId;
let sepChar = '?';
if (code) {
path = path + sepChar + 'code=' + encodeURIComponent(code);
sepChar = '&';
}
if (buildName) {
path = path + sepChar + 'bn=' + encodeURIComponent(buildName);
}
return path;
}