mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
23 lines
710 B
TypeScript
23 lines
710 B
TypeScript
import $ from 'jquery';
|
|
import { confirm } from 'vj/components/dialog';
|
|
import { NamedPage } from 'vj/misc/Page';
|
|
import { i18n, request } from 'vj/utils';
|
|
|
|
export default new NamedPage('training_edit', () => {
|
|
let confirmed = false;
|
|
$(document).on('click', '[name="operation"]', (ev) => {
|
|
ev.preventDefault();
|
|
if (confirmed) {
|
|
return request.post('.', { operation: 'delete' }).then((res) => {
|
|
window.location.href = res.url;
|
|
});
|
|
}
|
|
const message = 'Confirm deleting this training? Its files and status will be deleted as well.';
|
|
return confirm(i18n(message)).then((yes) => {
|
|
if (!yes) return;
|
|
confirmed = true;
|
|
ev.target.click();
|
|
});
|
|
});
|
|
});
|