@@ -165,7 +165,7 @@ export class TelekomProfileMenu {
165
165
buildLogoutButton ( ) {
166
166
return {
167
167
type : 'button' ,
168
- name : this . logoutLabel ,
168
+ name : this . logoutLabel || 'Logout' ,
169
169
href : this . logoutUrl || LOGOUT_DEFAULT ,
170
170
variant : 'secondary' ,
171
171
onClick : this . logoutHandler ,
@@ -176,17 +176,11 @@ export class TelekomProfileMenu {
176
176
const divider = [ { type : 'divider' } ] ;
177
177
178
178
const userInfo = readData ( this . userInfo ) ;
179
- if ( ! userInfo ) {
180
- // console.error("userInfo missing");
181
- }
182
- userInfo . type = 'userInfo' ;
183
-
184
- let serviceLinks = readData ( this . serviceLinks ) ;
185
- if ( ! serviceLinks ) {
186
- // console.error("serviceLinks missing");
187
- serviceLinks = [ ] ;
179
+ if ( userInfo ) {
180
+ userInfo . type = 'userInfo' ;
188
181
}
189
182
183
+ const serviceLinks = readData ( this . serviceLinks ) || [ ] ;
190
184
for ( const el of serviceLinks ) {
191
185
el . type = 'item' ;
192
186
}
@@ -200,9 +194,11 @@ export class TelekomProfileMenu {
200
194
201
195
let menu = [ ] ;
202
196
203
- menu = menu . concat ( userInfo ) ;
197
+ if ( userInfo ) {
198
+ menu = menu . concat ( userInfo ) ;
199
+ }
204
200
205
- if ( ! this . serviceLinksEmpty ( ) ) {
201
+ if ( userInfo && ! this . serviceLinksEmpty ( ) ) {
206
202
menu = menu . concat ( divider ) ;
207
203
}
208
204
@@ -221,7 +217,10 @@ export class TelekomProfileMenu {
221
217
}
222
218
223
219
serviceLinksEmpty ( ) {
224
- return ( this . hideLoginSettings && this . serviceLinks . length < 1 ) === true ;
220
+ return (
221
+ this . hideLoginSettings &&
222
+ ( ! this . serviceLinks || this . serviceLinks . length < 1 )
223
+ ) ;
225
224
}
226
225
227
226
buildDesktopMenuStyles ( ) {
0 commit comments