1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Only show logout option if user is logged in

This commit is contained in:
RoboMagus 2024-03-09 16:48:17 +01:00
parent 0a42aa1913
commit 4388e5e29a

View file

@ -304,11 +304,14 @@ function askForExit() {
return; return;
} }
import('../scripts/clientUtils').then(() => {
import('../components/actionSheet/actionSheet').then((actionsheet) => { import('../components/actionSheet/actionSheet').then((actionsheet) => {
const userId = Dashboard.getCurrentUserId();
const logoutEntry = userId ? [{ id: 'logout', name: globalize.translate('ButtonSignOut') }] : [];
exitPromise = actionsheet.show({ exitPromise = actionsheet.show({
title: globalize.translate('MessageConfirmAppExit'), title: globalize.translate('MessageConfirmAppExit'),
items: [ items: [
{ id: 'logout', name: globalize.translate('ButtonSignOut') }, ...logoutEntry,
{ id: 'yes', name: globalize.translate('Yes') }, { id: 'yes', name: globalize.translate('Yes') },
{ id: 'no', name: globalize.translate('No') } { id: 'no', name: globalize.translate('No') }
] ]
@ -316,14 +319,13 @@ function askForExit() {
if (value === 'yes') { if (value === 'yes') {
doExit(); doExit();
} else if (value === 'logout') { } else if (value === 'logout') {
import('../scripts/clientUtils').then((clientUtils) => {
Dashboard.logout(); Dashboard.logout();
});
} }
}).finally(function () { }).finally(function () {
exitPromise = null; exitPromise = null;
}); });
}); });
});
} }
let deviceId; let deviceId;