From cf4b85465e56149237ce70b262da88aea6ce09cb Mon Sep 17 00:00:00 2001 From: axolotle Date: Tue, 25 Jul 2023 22:51:03 +0200 Subject: [PATCH] default layout: update with user info and logout --- layouts/default.vue | 95 +++++++++++++++++++++++++++++++++++++-------- pages/index.vue | 51 ++---------------------- 2 files changed, 82 insertions(+), 64 deletions(-) diff --git a/layouts/default.vue b/layouts/default.vue index 18caed2..c9be068 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -3,27 +3,92 @@ const head = useLocaleHead({ addDirAttribute: true, addSeoAttributes: true, }) +const { t } = useI18n() +const isLoggedIn = useIsLoggedIn() +const me = await useUserInfo() + +const footerLinks = [ + { text: t('footerlink_edit'), to: '/edit' }, + { + text: t('footerlink_documentation'), + to: '//yunohost.org/docs', + newWindow: true, + }, + { text: t('footerlink_support'), to: '//yunohost.org/help', newWindow: true }, + { + text: t('footerlink_administration'), + to: '/yunohost/admin/', + newWindow: true, + }, +] + +async function logout() { + const { error } = await useApi('/logout') + + if (!error.value) { + // FIXME : meh, turns out the cookie is still valid after successfully calling the route for some reason ... !? + isLoggedIn.value = false + await navigateTo('/login') + } else { + // FIXME : display an error or something + } +}