You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
603 B

const getBasePath = (): string => {
return process.env.NODE_ENV === 'production' ? '/containers/matheothierry-portfolio_nuxt' : '/';
};
export const withBasePath = (path: string): string => {
if (path.startsWith('http://') || path.startsWith('https://')) {return path;}
const currentBasePath = getBasePath();
if (!currentBasePath || path === '') {return path;}
if (path.startsWith(currentBasePath)) {return path;}
if (path.startsWith('~/')) {return path;}
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
return `${currentBasePath}${normalizedPath}`;
};