Fix naming and format code

This commit is contained in:
2023-09-12 10:07:04 +07:00
parent f46c052a80
commit ac9b662255
2 changed files with 2 additions and 5 deletions
@@ -1,4 +1,4 @@
export const URL = {
export const SUBDIRECTORY_URL = {
LOGIN: 'login',
REGISTER: 'register',
HOME: '',
@@ -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);
}