Fix baseURI prefix and suffix slashes

This commit is contained in:
John Furrow
2017-02-13 22:44:19 -08:00
parent 4942ef9681
commit 21edd2f604
2 changed files with 41 additions and 28 deletions
+14 -1
View File
@@ -1,7 +1,20 @@
import BaseStore from './BaseStore';
const transformConfig = {
baseURI: baseURI => baseURI.replace(/\/$/, '')
baseURI: baseURI => {
const shouldAddSlashEnd = !baseURI.endsWith('/');
const shouldAddSlashStart = !baseURI.startsWith('/');
if (shouldAddSlashEnd) {
baseURI = `${baseURI}/`;
}
if (shouldAddSlashStart) {
baseURI = `/${baseURI}`;
}
return baseURI;
}
};
class ConfigStoreClass extends BaseStore {