* implement change * struggling with tests * extend implementation to relevant views * update Article.test.jsx snapshot * fix failing specs * query userData more robustly * default saveable value in SaveButton component * fix spec * fetch currentUser async
12 lines
422 B
JavaScript
12 lines
422 B
JavaScript
import { getUserDataAndCsrfToken } from '@utilities/getUserDataAndCsrfToken';
|
|
|
|
getUserDataAndCsrfToken().then(({ currentUser }) => {
|
|
const currentUserId = currentUser && currentUser.id;
|
|
|
|
document.querySelectorAll('.bookmark-button').forEach((button) => {
|
|
const { articleAuthorId } = button.dataset;
|
|
if (currentUserId && articleAuthorId == currentUserId) {
|
|
button.classList.add('hidden');
|
|
}
|
|
});
|
|
});
|