Allow manga +1 button to update both kitsu and mal
This commit is contained in:
parent
be252836be
commit
528deae789
@ -8,7 +8,6 @@
|
|||||||
_.on('.manga.list', 'click', '.edit_buttons button', (e) => {
|
_.on('.manga.list', 'click', '.edit_buttons button', (e) => {
|
||||||
let thisSel = e.target;
|
let thisSel = e.target;
|
||||||
let parentSel = _.closestParent(e.target, 'article');
|
let parentSel = _.closestParent(e.target, 'article');
|
||||||
let mangaId = parentSel.id.replace('manga-', '');
|
|
||||||
let type = thisSel.classList.contains('plus_one_chapter') ? 'chapter' : 'volume';
|
let type = thisSel.classList.contains('plus_one_chapter') ? 'chapter' : 'volume';
|
||||||
let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10);
|
let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10);
|
||||||
let total = parseInt(_.$(`.${type}_count`, parentSel)[0].textContent, 10);
|
let total = parseInt(_.$(`.${type}_count`, parentSel)[0].textContent, 10);
|
||||||
@ -20,7 +19,8 @@
|
|||||||
|
|
||||||
// Setup the update data
|
// Setup the update data
|
||||||
let data = {
|
let data = {
|
||||||
id: mangaId,
|
id: parentSel.dataset.kitsuId,
|
||||||
|
mal_id: parentSel.dataset.malId,
|
||||||
data: {
|
data: {
|
||||||
progress: completed
|
progress: completed
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ class Manga extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
if ($this->request->getHeader('content-type')[0] === 'application/json')
|
if (stripos($this->request->getHeader('content-type')[0], 'application/json') !== FALSE)
|
||||||
{
|
{
|
||||||
$data = Json::decode((string)$this->request->getBody());
|
$data = Json::decode((string)$this->request->getBody());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user