-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement voucher shortcut buttons #962
base: main
Are you sure you want to change the base?
Conversation
weeman1337
commented
Jul 25, 2022
•
edited
edited
- migrate to Twig template
/** | ||
* Handles +1 voucher clicks. | ||
*/ | ||
document.addEventListener('click', async (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte nicht auf document den click registrieren. Sondern nur auf den Elementen die du unten prüfst.
Dann wird auch nicht jeder click hier durch gehauen.
const dataset = element.dataset; | ||
|
||
if ( | ||
typeof dataset.voucherAmount === 'undefined' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset.voucherAmount == null
null
und undefined
sind nur gegenseitig equivalent => damit wird automatisch auf null
und auf undefined
geprüft. Braucht also kein typeof
try { | ||
csrfToken = getCSRFToken(); | ||
} catch (e) { | ||
console.log(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.error
?
Also this branch has to be rebased as it has merge conflicts @weeman1337 ;) |