Skip to content

Commit

Permalink
UserMenuItem type
Browse files Browse the repository at this point in the history
  • Loading branch information
timbl committed Nov 17, 2024
1 parent 9635981 commit 171d8b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mainPage/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const USER_GUIDE_MENU_ITEM = 'User guide'
const REPORT_A_PROBLEM_MENU_ITEM = 'Report a problem'
const SHOW_YOUR_PROFILE_MENU_ITEM = 'Show your profile'
const LOG_OUT_MENU_ITEM = 'Log out'

type UserMenuItem = { label: string; onclick: () => void } ;
/**
* URLS
*/
Expand All @@ -39,16 +41,16 @@ async function setUserMenu (outliner: any) {
onclick: () => openUserProfile(outliner)
}

const logOut = {
const logOut: UserMenuItem = {
label: LOG_OUT_MENU_ITEM,
onclick: () => {
authSession.logout()
}
}

// the order of the menu is important here, show profile first and logout last
let userMenuList = [] // was [showProfile]
userMenuList = userMenuList.concat(await getMenuItems(outliner))
let userMenuList:UserMenuItem[] = [] // was [showProfile]
userMenuList = userMenuList.concat(await getMenuItems(outliner));
userMenuList.push(logOut)

return userMenuList
Expand Down

0 comments on commit 171d8b8

Please sign in to comment.