mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
customLogo: fallback to yunohost default logo if api is down
This commit is contained in:
parent
2c8f681f77
commit
d83330256b
1 changed files with 27 additions and 17 deletions
|
@ -1,7 +1,13 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
type CustomLogo = Partial<Record<'is' | 'content', string>>
|
||||||
|
let customLogo: Ref<CustomLogo> | ComputedRef<CustomLogo>
|
||||||
|
|
||||||
|
try {
|
||||||
const settings = await useSettings()
|
const settings = await useSettings()
|
||||||
const customLogo = computed(() => {
|
|
||||||
|
customLogo = computed(() => {
|
||||||
const logo = settings.value.portal_logo
|
const logo = settings.value.portal_logo
|
||||||
|
|
||||||
if (!logo) return {}
|
if (!logo) return {}
|
||||||
|
|
||||||
const [mimetype, base64Content] = logo.split(':')
|
const [mimetype, base64Content] = logo.split(':')
|
||||||
|
@ -18,6 +24,10 @@ const customLogo = computed(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
// If `yunohost-portal-api` is down we can't get settings
|
||||||
|
customLogo = ref({})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Add table
Reference in a new issue