Skip to content

Commit

Permalink
Fix logo composable logic 🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Jun 17, 2024
1 parent c4b8547 commit 4965508
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Tekst-Web/src/composables/logo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ const customLogoAvailable = ref(false);
const customLogoDarkmodeAvailable = ref(false);

(async () => {
customLogoAvailable.value = await useFetch(customLogo).error.value;
customLogoDarkmodeAvailable.value = await useFetch(customLogoDarkmode).error.value;
customLogoAvailable.value = !(await useFetch(customLogo).error.value);
customLogoDarkmodeAvailable.value = !(await useFetch(customLogoDarkmode).error.value);
console.log(customLogoAvailable.value, customLogoDarkmodeAvailable.value);
})();

export function useLogo() {
const theme = useThemeStore();
const darkPreferred = usePreferredDark();
const logoLight = computed(() => (!customLogoAvailable.value ? logo : customLogo));
const logoDark = computed(() => (!customLogoAvailable.value ? logoDarkmode : customLogoDarkmode));
const logoLight = computed(() => (customLogoAvailable.value ? customLogo : logo));
const logoDark = computed(() =>
customLogoDarkmodeAvailable.value ? customLogoDarkmode : logoDarkmode
);
const pageLogo = computed(() => (theme.darkMode ? logoDark.value : logoLight.value));
const favicon = computed(() => (darkPreferred.value ? logoDark.value : logoLight.value));
return { pageLogo, favicon };
Expand Down

0 comments on commit 4965508

Please sign in to comment.