client: adapted code to use <base> HTML tag

This commit is contained in:
Shyam Sunder
2018-07-24 00:14:29 -04:00
committed by Marcin Kurczewski
parent b29bf8b37a
commit defada45ab
7 changed files with 34 additions and 33 deletions

View File

@ -256,7 +256,7 @@ class Api extends events.EventTarget {
_getFullUrl(url) {
const fullUrl =
('/api/' + url).replace(/([^:])\/+/g, '$1/');
('api/' + url).replace(/([^:])\/+/g, '$1/');
const matches = fullUrl.match(/^([^?]*)\??(.*)$/);
const baseUrl = matches[1];
const request = matches[2];
@ -327,7 +327,7 @@ class Api extends events.EventTarget {
let abortFunction = () => {};
let returnedPromise = new Promise((resolve, reject) => {
let uploadPromise = this._rawRequest(
'/uploads', request.post, {}, {content: file}, options);
'uploads', request.post, {}, {content: file}, options);
abortFunction = () => uploadPromise.abort();
return uploadPromise.then(
response => {

View File

@ -28,7 +28,7 @@ class TopNavigationController {
}
_updateNavigationFromPrivileges() {
topNavigation.get('account').url = '/user/' + api.userName;
topNavigation.get('account').url = 'user/' + api.userName;
topNavigation.get('account').imageUrl =
api.user ? api.user.avatarUrl : null;

View File

@ -76,23 +76,23 @@ class TopNavigation extends events.EventTarget {
function _makeTopNavigation() {
const ret = new TopNavigation();
ret.add('home', new TopNavigationItem('H', 'Home', '/'));
ret.add('posts', new TopNavigationItem('P', 'Posts', '/posts'));
ret.add('upload', new TopNavigationItem('U', 'Upload', '/upload'));
ret.add('comments', new TopNavigationItem('C', 'Comments', '/comments'));
ret.add('tags', new TopNavigationItem('T', 'Tags', '/tags'));
ret.add('users', new TopNavigationItem('S', 'Users', '/users'));
ret.add('account', new TopNavigationItem('A', 'Account', '/user/{me}'));
ret.add('register', new TopNavigationItem('R', 'Register', '/register'));
ret.add('login', new TopNavigationItem('L', 'Log in', '/login'));
ret.add('logout', new TopNavigationItem('O', 'Logout', '/logout'));
ret.add('help', new TopNavigationItem('E', 'Help', '/help'));
ret.add('home', new TopNavigationItem('H', 'Home', ''));
ret.add('posts', new TopNavigationItem('P', 'Posts', 'posts'));
ret.add('upload', new TopNavigationItem('U', 'Upload', 'upload'));
ret.add('comments', new TopNavigationItem('C', 'Comments', 'comments'));
ret.add('tags', new TopNavigationItem('T', 'Tags', 'tags'));
ret.add('users', new TopNavigationItem('S', 'Users', 'users'));
ret.add('account', new TopNavigationItem('A', 'Account', 'user/{me}'));
ret.add('register', new TopNavigationItem('R', 'Register', 'register'));
ret.add('login', new TopNavigationItem('L', 'Log in', 'login'));
ret.add('logout', new TopNavigationItem('O', 'Logout', 'logout'));
ret.add('help', new TopNavigationItem('E', 'Help', 'help'));
ret.add(
'settings',
new TopNavigationItem(
null,
'<i class=\'fa fa-cog\'></i>',
'/settings'));
'settings'));
return ret;
}

View File

@ -51,7 +51,7 @@ function formatClientLink(...values) {
parts.push(escapeParam(value.toString()));
}
}
return '/' + parts.join('/');
return parts.join('/');
}
module.exports = {