[short url] use url.format when creating /goto link

This commit is contained in:
Jonathan Budzenski 2016-03-21 09:09:04 -05:00
parent a8c1305a9b
commit 2a716734d0

View file

@ -16,7 +16,11 @@ export default function createUrlShortener(Notifier, $http, $location) {
const formData = { url: relativeUrl };
return $http.post(`${basePath}/shorten`, formData).then((result) => {
return `${parsedUrl.protocol}//${parsedUrl.host}${basePath}/goto/${result.data}`;
return url.format({
protocol: parsedUrl.protocol,
host: parsedUrl.host,
pathname: `${basePath}/goto/${result.data}`
});
}).catch((response) => {
notify.error(response);
});