mirror of
https://github.com/Nezumi-2711/javascript-training.git
synced 2026-09-22 13:38:43 +00:00
Fix naming and format code
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
export const URL = {
|
export const SUBDIRECTORY_URL = {
|
||||||
LOGIN: 'login',
|
LOGIN: 'login',
|
||||||
REGISTER: 'register',
|
REGISTER: 'register',
|
||||||
HOME: '',
|
HOME: '',
|
||||||
|
|||||||
@@ -66,13 +66,10 @@ export const convertDataObjectToModel = (data) => {
|
|||||||
|
|
||||||
export const getSubdirectoryURL = () => {
|
export const getSubdirectoryURL = () => {
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
|
|
||||||
const parts = url.split('/'); // Results: ['http:', '', 'example.com', '']
|
const parts = url.split('/'); // Results: ['http:', '', 'example.com', '']
|
||||||
|
|
||||||
const subDirectory = parts[3]; // Get subdirectory url only
|
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) {
|
if (index !== -1) {
|
||||||
return subDirectory.substring(0, index);
|
return subDirectory.substring(0, index);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user