Skip to content

Commit

Permalink
fix bug where we could decline a required app with the "decline all" btn
Browse files Browse the repository at this point in the history
fixes #9, thanks.
  • Loading branch information
manuhabitela committed Apr 3, 2019
1 parent 00d8d1c commit 54ae635
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Apps extends React.Component {

const toggle = (apps, value) => {
apps.map((app)=>{
manager.updateConsent(app.name, value)
manager.updateConsent(app, value)
})
}

Expand Down
9 changes: 6 additions & 3 deletions src/consent-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ export default class ConsentManager {

declineAll(){
this.config.apps.map((app) => {
this.updateConsent(app.name, false)
this.updateConsent(app, false)
})
}

updateConsent(name, value){
this.consents[name] = value
updateConsent(app, value){
if (app.required && !value) {
return;
}
this.consents[app.name] = value
this.notify('consents', this.consents)
}

Expand Down

0 comments on commit 54ae635

Please sign in to comment.