Link swagger in navbar (#1984)

fix point 1 from #1944 

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
Patrick Schratz 2023-07-13 20:34:02 +02:00 committed by GitHub
parent a778b5fb90
commit 004d72a853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -5,6 +5,7 @@
"repos": "Repos", "repos": "Repos",
"repositories": "Repositories", "repositories": "Repositories",
"docs": "Docs", "docs": "Docs",
"api": "API",
"logout": "Logout", "logout": "Logout",
"search": "Search…", "search": "Search…",
"username": "Username", "username": "Username",

View file

@ -15,6 +15,8 @@
</router-link> </router-link>
<!-- Docs Link --> <!-- Docs Link -->
<a :href="docsUrl" target="_blank" class="navbar-link navbar-clickable hidden md:flex">{{ $t('docs') }}</a> <a :href="docsUrl" target="_blank" class="navbar-link navbar-clickable hidden md:flex">{{ $t('docs') }}</a>
<!-- API Link -->
<a :href="apiUrl" target="_blank" class="navbar-link navbar-clickable hidden md:flex">{{ $t('api') }}</a>
</div> </div>
<!-- Right Icons Box --> <!-- Right Icons Box -->
<div class="flex ml-auto -m-1.5 items-center space-x-2 text-white dark:text-gray-400"> <div class="flex ml-auto -m-1.5 items-center space-x-2 text-white dark:text-gray-400">
@ -70,6 +72,7 @@ export default defineComponent({
const authentication = useAuthentication(); const authentication = useAuthentication();
const { darkMode } = useDarkMode(); const { darkMode } = useDarkMode();
const docsUrl = config.docs || undefined; const docsUrl = config.docs || undefined;
const apiUrl = `${config.rootURL ?? ''}/swagger/index.html`;
function doLogin() { function doLogin() {
authentication.authenticate(route.fullPath); authentication.authenticate(route.fullPath);
@ -77,7 +80,7 @@ export default defineComponent({
const version = config.version?.startsWith('next') ? 'next' : config.version; const version = config.version?.startsWith('next') ? 'next' : config.version;
return { darkMode, user: authentication.user, doLogin, docsUrl, version }; return { darkMode, user: authentication.user, doLogin, docsUrl, version, apiUrl };
}, },
}); });
</script> </script>