Skip to content

Commit 1b26973

Browse files
committed
fixed get user_data error
1 parent a3f6351 commit 1b26973

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ def get(session):
256256
if user_data:
257257
# User is logged in; show profile and logout buttons
258258
name = H4(user_data['data']['attributes']['full_name'],cls="card-title text-2xl")
259-
email = user_data['data']['attributes']['email']
259+
email = user_data.get('data', {}).get('attributes', {}).get('email')
260+
260261
logout_button = A("Logout", href="/logout", cls="btn btn-sm btn-secondary m-1")
261262
profile_image = Img(src=user_data['data']['attributes']['thumb_url'])
262263

@@ -314,7 +315,8 @@ def get(session):
314315
if user_data:
315316
# User is logged in; show profile and logout buttons
316317
name = H3(user_data['data']['attributes']['full_name'],cls="card-title")
317-
email = user_data['data']['attributes']['email']
318+
email = user_data.get('data', {}).get('attributes', {}).get('email')
319+
318320
logout_button = A("Logout", href="/logout", cls="btn btn-sm btn-secondary m-1")
319321
profile_image = Img(src=user_data['data']['attributes']['thumb_url'])
320322

0 commit comments

Comments
 (0)