Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clear data when logging out
  • Loading branch information
dusty-phillips committed Aug 27, 2018
1 parent b9a22cd commit d64a338
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/components/AuthButton.js
Expand Up @@ -29,19 +29,29 @@ class AuthButton extends Component {
</div>
)
}
return <button
style={{ width: "20rem" }}
onClick={() => this.props.firebase.logout()}
> Logout</button >

return (
<button
style={{ width: "20rem" }}
onClick={async () => {
await this.props.firebase.logout()
this.props.clearFirestore()
}}
>
Logout
</button >
)
}
}

const mapStateToProps = state => {
return { auth: state.firebase.auth }
}

const mapDispatchToProps = {
const mapDispatchToProps = dispatch => {
return {
clearFirestore: () => dispatch({ type: '@@reduxFirestore/CLEAR_DATA' })

}
}


Expand Down

0 comments on commit d64a338

Please sign in to comment.