'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(); } } ); } }