dash.exceptions.InvalidCallbackReturnValue Error


I have a problem, I can’t redirect to my ‘/conneted’ page and I don’t know why.
I can authenticate and connect to my application I can go to every pages ( home ‘/’, project ‘/page-1’, prediction ‘/page-2’) but one ‘/connected’.

I have the app.py

app.layout =  html.Div([ navbar,
dcc.Location(id='logout-redirect', refresh=True),
                 html.Div(id='page-content', children=[ login_page, signup_page,homepage, logout]),   ])

    dash.dependencies.Output('page-content', 'children'),
        dash.dependencies.Input('url', 'pathname'),
def display_or_handle_page(pathname):
    global logged_in

    if logged_in:
        if pathname == '/':
            return homepage
        elif pathname == '/page-1':
            return projectpage
        elif pathname == '/page-2':
            return mlpage
        elif pathname == '/connected':
            return logout
            return homepage
        if pathname == '/login':
            return login_page
        elif pathname == '/inscription':
            return signup_page
            return dcc.Location(pathname='/login', id='url')

the callback function to logout

    Output('logout-redirect', 'pathname'),
    Input('logout-button', 'n_clicks'))
def logout(n_clicks):
    global logged_in
    if n_clicks:
        logged_in = False  
        return "/login"  
    return dash.no_update 

and here is the layout where the deconnexion button is

logout = html.Div(
                html.H1(f'Vous êtes connecté !'),
                        html.Button('Déconnexion', id='logout-button',
                                    style={'width': '150px', 'height': '40px', 'margin': '10px',
                                           'cursor': 'pointer', 'border': '0px',
                                           'border-radius': '5px', 'background-color':
                                           'black', 'color': 'white', 'text-transform':
                                           'uppercase', 'font-size': '15px'})
            style={'text-align': 'center'}
        ),       html.Div(id='logout-output')


I always have the error

dash.exceptions.InvalidCallbackReturnValue: The callback for `<Output `page-content.children`>`
                returned a value having type `function`
                which is not JSON serializable.

The value in question is either the only value returned,
or is in the top level of the returned list,

                and has string representation
                `<function logout at 0x00000208420439D0>`

                In general, Dash properties can only be
                dash components, strings, dictionaries, numbers, None,
                or lists of those.

I dont understand … HELP :smiling_face_with_tear:

Thank you