Spaces:
Running
Running
# components/header.py | |
import gradio as gr | |
from utils.auth import AuthService | |
class Header: | |
def __init__(self): | |
with gr.Row(variant="panel", elem_classes="header-row") as self.container: | |
self.welcome = gr.Markdown() | |
self.logout_btn = gr.Button("Log out", scale=0, min_width=90) | |
# ---------------- wiring ---------------- | |
def register_callbacks(self, login_page, dashboard_page, session_state): | |
self.logout_btn.click( | |
fn=AuthService.logout, | |
inputs=[session_state], # ← حتماً داخل لیست | |
outputs=[ | |
login_page.container, # 1 | |
dashboard_page.container, # 2 | |
self.welcome, # 3 | |
login_page.message, # 4 | |
], | |
) |