diff --git a/contact-frontend/packages/apps/web/src/layouts/NavLayout.vue b/contact-frontend/packages/apps/web/src/layouts/NavLayout.vue index 51f5d8b5..279e538b 100644 --- a/contact-frontend/packages/apps/web/src/layouts/NavLayout.vue +++ b/contact-frontend/packages/apps/web/src/layouts/NavLayout.vue @@ -2,6 +2,7 @@ import { ref } from 'vue' import { RouterLink, RouterView, useRouter } from 'vue-router' import { Nav } from '@cskefu/shared-ui' +import { isUrl } from '@cskefu/shared-utils' import { ROUTE_NAME } from '@cskefu/models' import { @@ -71,11 +72,12 @@ switch (path) { const router = useRouter() function handleClickNav(name: string) { - if (name.startsWith('https://') || name.startsWith('http://')) { + if (isUrl(name)) { window.open(name, '_blank') return } if (name === 'logout') { + // todo return } router.push({ name }) diff --git a/contact-frontend/packages/shared/utils/src/index.ts b/contact-frontend/packages/shared/utils/src/index.ts index 49800c7a..a1f356ae 100644 --- a/contact-frontend/packages/shared/utils/src/index.ts +++ b/contact-frontend/packages/shared/utils/src/index.ts @@ -1 +1,2 @@ export * from './routes' +export * from './is' diff --git a/contact-frontend/packages/shared/utils/src/is.ts b/contact-frontend/packages/shared/utils/src/is.ts new file mode 100644 index 00000000..7fa45153 --- /dev/null +++ b/contact-frontend/packages/shared/utils/src/is.ts @@ -0,0 +1,3 @@ +export function isUrl(url: string) { + return url.startsWith('https://') || url.startsWith('http://') +}