попа
This commit is contained in:
25
mirzaev/surikovlib/system/public/js/delete.js
Normal file
25
mirzaev/surikovlib/system/public/js/delete.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
function remove(id, element = null) {
|
||||
if (typeof id === 'number') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Запрос
|
||||
fetch(`https://surikovlib.ru/books/${id}/delete`, {
|
||||
method: 'POST'
|
||||
}).then(
|
||||
(value) => {
|
||||
return value.json();
|
||||
}
|
||||
).then(
|
||||
(response) => {
|
||||
if (response.status === true) {
|
||||
// Удалена книга
|
||||
|
||||
// Удаление элемента
|
||||
if (typeof element === 'object') element.remove();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
24
mirzaev/surikovlib/system/public/js/rotate.js
Normal file
24
mirzaev/surikovlib/system/public/js/rotate.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
function rotate(id, page, reload = false) {
|
||||
if (typeof id === 'number' && typeof page === 'number') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Запрос
|
||||
fetch(`https://surikovlib.ru/books/${id}/${page}/rotate`, {
|
||||
method: 'POST'
|
||||
}).then(
|
||||
(value) => {
|
||||
return value.json();
|
||||
}
|
||||
).then(
|
||||
(response) => {
|
||||
if (response.status === true) {
|
||||
// Перевёрнута страница
|
||||
|
||||
if (reload === true) location.reload();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user