Do not use window.WOODPECKER_* variables directly (#1992)

use the config helper instead
This commit is contained in:
qwerty287 2023-07-13 15:57:50 +02:00 committed by GitHub
parent 570f5044e8
commit a778b5fb90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -12,13 +12,14 @@
import { computed, toRef } from 'vue'; import { computed, toRef } from 'vue';
import Icon from '~/components/atomic/Icon.vue'; import Icon from '~/components/atomic/Icon.vue';
import useConfig from '~/compositions/useConfig';
const props = defineProps<{ const props = defineProps<{
url: string; url: string;
topic: string; topic: string;
}>(); }>();
const docsBaseUrl = window.WOODPECKER_DOCS; const docsBaseUrl = useConfig().docs;
const url = toRef(props, 'url'); const url = toRef(props, 'url');
const topic = toRef(props, 'topic'); const topic = toRef(props, 'topic');
const docsUrl = computed(() => (url.value.startsWith('http') ? url.value : `${docsBaseUrl}${url.value}`)); const docsUrl = computed(() => (url.value.startsWith('http') ? url.value : `${docsBaseUrl}${url.value}`));

View file

@ -69,7 +69,7 @@ export default defineComponent({
const route = useRoute(); const route = useRoute();
const authentication = useAuthentication(); const authentication = useAuthentication();
const { darkMode } = useDarkMode(); const { darkMode } = useDarkMode();
const docsUrl = window.WOODPECKER_DOCS; const docsUrl = config.docs || undefined;
function doLogin() { function doLogin() {
authentication.authenticate(route.fullPath); authentication.authenticate(route.fullPath);