Skip to content
Snippets Groups Projects
Commit 8f9fdfe6 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

no need to refine with to attribute

parent 7b6b879d
No related branches found
No related tags found
No related merge requests found
Pipeline #112571 passed
...@@ -12,7 +12,9 @@ RUN npm install ...@@ -12,7 +12,9 @@ RUN npm install
### STAGE: Dev ### STAGE: Dev
FROM node:19.5-bullseye-slim as dev FROM node:19.5-bullseye-slim as dev
ARG BASE_URL=/
ENV NUXT_APP_BASE_URL=${BASE_URL}
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY --from=install /usr/src/app ./ COPY --from=install /usr/src/app ./
COPY . /usr/src/app COPY . /usr/src/app
......
...@@ -27,20 +27,20 @@ const sections = ref([ ...@@ -27,20 +27,20 @@ const sections = ref([
]); ]);
const computedSections = computed(() => { // const computedSections = computed(() => {
return sections.value.map(section => { // return sections.value.map(section => {
if (section?.to) { // if (section?.to) {
const { refinedUrl } = useRefinedUrl(section.to) // const { refinedUrl } = useRefinedUrl(section.to)
return { ...section, to: refinedUrl.value } // return { ...section, to: refinedUrl.value }
} // }
else { // else {
return section // return section
} // }
}) // })
}) // })
const drawer = ref(true); const drawer = ref(true);
...@@ -76,7 +76,7 @@ const computedNavigation = computed(() => { ...@@ -76,7 +76,7 @@ const computedNavigation = computed(() => {
</span> </span>
</v-app-bar-title> </v-app-bar-title>
<template #append v-if="!mobile"> <template #append v-if="!mobile">
<v-btn v-for="section in computedSections" :key="section.id" color="primary" :to="section?.to ?? null" <v-btn v-for="section in sections" :key="section.id" color="primary" :to="section?.to ?? null"
:href="section?.href ?? null" exact> :href="section?.href ?? null" exact>
{{ section.label }} {{ section.label }}
</v-btn> </v-btn>
......
import { join } from "path";
import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo"; import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo";
export function useRefinedUrl(url: string | Ref<string>) { export function useRefinedUrl(url: string | Ref<string>) {
console.log(useRuntimeConfig().app.baseURL)
const refinedUrl = computed(() => { const refinedUrl = computed(() => {
const sanitzedUrl = toValue(url) const sanitzedUrl = toValue(url)
if (sanitzedUrl.startsWith("/") && !sanitzedUrl.startsWith("//")) { if (sanitzedUrl.startsWith("/") && !sanitzedUrl.startsWith("//")) {
const _base = withLeadingSlash( const _base = withLeadingSlash(
withTrailingSlash(useRuntimeConfig().app.baseURL) withTrailingSlash(useRuntimeConfig().app.baseURL)
); );
console.log(_base)
if (_base !== "/" && !sanitzedUrl.startsWith(_base)) { if (_base !== "/" && !sanitzedUrl.startsWith(_base)) {
return joinURL(_base, sanitzedUrl); return joinURL(_base, sanitzedUrl);
} }
......
...@@ -4,6 +4,8 @@ services: ...@@ -4,6 +4,8 @@ services:
build: build:
context: . context: .
target: dev target: dev
args:
BASE_URL: /wiki/
container_name: nuxt container_name: nuxt
environment: environment:
HOST: 0.0.0.0 HOST: 0.0.0.0
......
...@@ -48,6 +48,8 @@ const systems = computed(() => { ...@@ -48,6 +48,8 @@ const systems = computed(() => {
}; };
}); });
}); });
</script> </script>
<template> <template>
<v-card flat color="transparent"> <v-card flat color="transparent">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment