Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Add usage example in the docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Nov 28, 2018
1 parent 54681a8 commit d4ed9c8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
20 changes: 20 additions & 0 deletions dash_core_components/LogoutButton.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
class LogoutButton(Component):
"""A LogoutButton component.
Logout button to submit a form post request to the `logout_url` prop.
Usage is intended for dash-deployment-server authentication.
DDS usage:
`dcc.LogoutButton(logout_url=os.getenv('DASH_LOGOUT_URL'))`
Custom usage:
- Implement a login mechanism.
- Create a flask route with a post method handler.
`@app.server.route('/logout', methods=['POST'])`
- The logout route should perform what's necessary for the user to logout.
- If you store the session in a cookie, clear the cookie:
`rep = flask.Response(); rep.set_cookie('session', '', expires=0)`
- Create a logout button component and assign it the logout_url
`dcc.LogoutButton(logout_url='/logout')`
See https://dash.plot.ly/dash-core-components/logout_button
for more documentation and examples.
Keyword arguments:
- id (string; optional): Id of the button.
Expand Down
Loading

0 comments on commit d4ed9c8

Please sign in to comment.