Skip to content

Commit

Permalink
Only show logout option if user is logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMagus committed Mar 9, 2024
1 parent 0a42aa1 commit b895aaa
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/components/apphost.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,25 @@ function askForExit() {
return;
}

import('../components/actionSheet/actionSheet').then((actionsheet) => {
exitPromise = actionsheet.show({
title: globalize.translate('MessageConfirmAppExit'),
items: [
{ id: 'logout', name: globalize.translate('ButtonSignOut') },
{ id: 'yes', name: globalize.translate('Yes') },
{ id: 'no', name: globalize.translate('No') }
]
}).then(function (value) {
if (value === 'yes') {
doExit();
} else if (value === 'logout') {
import('../scripts/clientUtils').then((clientUtils) => {
import('../utils/dashboard').then(() => {
import('../components/actionSheet/actionSheet').then((actionsheet) => {
const userId = Dashboard.getCurrentUserId();
exitPromise = actionsheet.show({
title: globalize.translate('MessageConfirmAppExit'),
items: [
...(userId && { id: 'logout', name: globalize.translate('ButtonSignOut') }),
{ id: 'yes', name: globalize.translate('Yes'), selected: true },
{ id: 'no', name: globalize.translate('No') }
]
}).then(function (value) {
if (value === 'yes') {
doExit();
} else if (value === 'logout') {
Dashboard.logout();
});
}
}).finally(function () {
exitPromise = null;
}
}).finally(function () {
exitPromise = null;
});
});
});
}
Expand Down

0 comments on commit b895aaa

Please sign in to comment.