diff --git a/javascript-practice/src/js/constants/variable.js b/javascript-practice/src/js/constants/variable.js index 423aaef..4023721 100644 --- a/javascript-practice/src/js/constants/variable.js +++ b/javascript-practice/src/js/constants/variable.js @@ -1,4 +1,4 @@ -export const URL = { +export const SUBDIRECTORY_URL = { LOGIN: 'login', REGISTER: 'register', HOME: '', diff --git a/javascript-practice/src/js/helpers/helpers.js b/javascript-practice/src/js/helpers/helpers.js index 46c44fe..54b8fd5 100644 --- a/javascript-practice/src/js/helpers/helpers.js +++ b/javascript-practice/src/js/helpers/helpers.js @@ -66,13 +66,10 @@ export const convertDataObjectToModel = (data) => { export const getSubdirectoryURL = () => { const url = window.location.href; - const parts = url.split('/'); // Results: ['http:', '', 'example.com', ''] - const subDirectory = parts[3]; // Get subdirectory url only + const index = subDirectory.indexOf('?'); // Remove query behind subDirectory - // Remove query behind subDirectory - const index = subDirectory.indexOf('?'); if (index !== -1) { return subDirectory.substring(0, index); }