A callback that handles
Location looks as follow:
dash_app.layout = html.Div([
dbc.NavLink(html.I(className="bi bi-box-arrow-right text-dark"),
def handle_logout(n_clicks, href):
When i click the component
logout-link the location in an address bar gets actually changed, BUT page doesn’t get reloaded and this is wierd as before i’ve tried the same approach in different callbacks and it worked well when i simply return a new
It looks like your are returning to the pathname instead of the url.
Not sure if that will fix it or not.
You could also take a look at my logout flow from Flask_Login flow. I use a redirect in logout that redirects to login after 3 second.
You are a bit incorret,
href property has to be returned. Thx anyway ,
pathname is not what reloads a page.
@dash_app.callback(Output('location', 'pathname'), =>
About 3 seconds. To be honest, it looks as a workaround, when a user is clicking
logout one obviously expects to be logged out immidiately.
You changed from pathname to href? Is that correct, I believe that I recommended changing it from pathname…
Glad you got it working.
If you take a look here you can see how I perform the redirect, I return the pathname as ‘/login’ to the pathname element:
Yes, in the post above you can see two code lines
U said in the first reply “instead of the url” and i’ve got it literally as the property
Location.url which doesnt exist, that’s why i found it incorrect.
Another thing you can do is,
external_link=True, this will trigger the page to refresh, which should then log the user out.
dcc.Link, this is