mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 13:19:08 +01:00
Remove settings unblock TypeScript
This commit is contained in:
parent
1c4993df3f
commit
55f26cb7d4
2 changed files with 1 additions and 24 deletions
|
@ -1,21 +0,0 @@
|
|||
import { destroy } from '@rails/request.js';
|
||||
import { showNotification, showErrorNotification } from 'utilities/notifications';
|
||||
import I18n from 'retrospring/i18n';
|
||||
|
||||
export function unblockAnonymousHandler(event: Event): void {
|
||||
const button: HTMLButtonElement = event.currentTarget as HTMLButtonElement;
|
||||
const targetId = button.dataset.target;
|
||||
|
||||
destroy(`/ajax/block_anon/${targetId}`)
|
||||
.then(async response => {
|
||||
if (!response.ok) return;
|
||||
|
||||
const data = await response.json;
|
||||
showNotification(data.message, data.success);
|
||||
button.closest('.list-group-item').remove();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
showErrorNotification(I18n.translate('frontend.error.message'));
|
||||
});
|
||||
}
|
|
@ -2,7 +2,6 @@ import registerEvents from "utilities/registerEvents";
|
|||
import { profileHeaderChangeHandler, profilePictureChangeHandler } from "./crop";
|
||||
import { themeDocumentHandler, themeSubmitHandler } from "./theme";
|
||||
import { userSubmitHandler } from "./password";
|
||||
import { unblockAnonymousHandler } from "./block";
|
||||
|
||||
export default (): void => {
|
||||
themeDocumentHandler();
|
||||
|
@ -11,7 +10,6 @@ export default (): void => {
|
|||
{ type: 'submit', target: document.querySelector('form.edit_theme, form.new_theme'), handler: themeSubmitHandler },
|
||||
{ type: 'submit', target: document.querySelector('#edit_user'), handler: userSubmitHandler },
|
||||
{ type: 'change', target: document.querySelector('#user_profile_picture[type=file]'), handler: profilePictureChangeHandler },
|
||||
{ type: 'change', target: document.querySelector('#user_profile_header[type=file]'), handler: profileHeaderChangeHandler },
|
||||
{ type: 'click', target: document.querySelectorAll('[data-action="anon-unblock"]'), handler: unblockAnonymousHandler }
|
||||
{ type: 'change', target: document.querySelector('#user_profile_header[type=file]'), handler: profileHeaderChangeHandler }
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue