forked from Ivasoft/geovisio-website
add composable and config url user
This commit is contained in:
@@ -3,7 +3,10 @@ import Header from '@/components/Header.vue'
|
||||
import { RouterView } from 'vue-router'
|
||||
import { useMeta } from 'vue-meta'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import authConfig from './composables/auth.ts'
|
||||
const { authConf } = authConfig()
|
||||
const { t } = useI18n()
|
||||
|
||||
useMeta({
|
||||
title: t('general.title'),
|
||||
og: {
|
||||
@@ -21,7 +24,11 @@ useMeta({
|
||||
<metainfo>
|
||||
<template v-slot:title="{ content }">{{ content }}</template>
|
||||
</metainfo>
|
||||
<Header />
|
||||
<Header
|
||||
v-if="authConf.user_profile"
|
||||
:auth-enabled="authConf.enabled"
|
||||
:user-profile-url="authConf.user_profile.url"
|
||||
/>
|
||||
<RouterView />
|
||||
</template>
|
||||
<style scoped></style>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
path="/partager-des-photos"
|
||||
/>
|
||||
</div>
|
||||
<div class="item-with-sub">
|
||||
<div v-if="authEnabled" class="item-with-sub">
|
||||
<Link
|
||||
type="external"
|
||||
icon="bi bi-person-circle"
|
||||
@@ -49,7 +49,7 @@
|
||||
/>
|
||||
<i v-if="isLogged" class="chevron bi bi-chevron-up"></i>
|
||||
<div v-if="isLogged" class="sub-nav-block">
|
||||
<div class="logged-link">
|
||||
<div v-if="userProfileUrl" class="logged-link">
|
||||
<Link
|
||||
path="mon-compte"
|
||||
:text="$t('general.header.account_text')"
|
||||
@@ -85,6 +85,11 @@ import BetaText from '@/components/BetaText.vue'
|
||||
const { cookies } = useCookies()
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
defineProps({
|
||||
authEnabled: { type: Boolean, default: true },
|
||||
userProfileUrl: { type: String, default: null }
|
||||
})
|
||||
|
||||
let menuIsClosed = ref<boolean>(true)
|
||||
|
||||
function toggleMenu(): void {
|
||||
|
||||
15
src/composables/auth.ts
Normal file
15
src/composables/auth.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import axios from 'axios'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
export default function authConfig(): object {
|
||||
const authConf = ref<object>({})
|
||||
|
||||
async function getConfig(): Promise<object> {
|
||||
const { data } = await axios.get(
|
||||
`${import.meta.env.VITE_API_URL}api/configuration`
|
||||
)
|
||||
return data.auth
|
||||
}
|
||||
onMounted(async () => (authConf.value = await getConfig()))
|
||||
return { authConf }
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import axios from 'axios'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { onMounted, computed, ref } from 'vue'
|
||||
import GeoVisio from 'geovisio'
|
||||
import Header from '@/components/Header.vue'
|
||||
import Button from '@/components/Button.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<p class="upload-text" v-html="$t('pages.upload.description')" />
|
||||
<div v-if="!isLogged" class="wrapper-account">
|
||||
<div v-if="!isLogged && authConf.enabled" class="wrapper-account">
|
||||
<h4 class="account-subtitle">
|
||||
{{ $t('pages.upload.sub_title') }}
|
||||
</h4>
|
||||
@@ -92,6 +92,8 @@ import { useCookies } from 'vue3-cookies'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute } from 'vue-router'
|
||||
import authConfig from '../composables/auth.ts'
|
||||
const { authConf } = authConfig()
|
||||
const { cookies } = useCookies()
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
|
||||
Reference in New Issue
Block a user