Partially fix #9 -- API calls fail on 'Plan to Watch' section

This commit is contained in:
Timothy Warren 2016-02-09 20:12:39 -05:00
parent 918b8fd18c
commit db69b13d87
3 changed files with 16 additions and 8 deletions

View File

@ -3,6 +3,11 @@
<h2>Add Anime to your Collection</h2>
<form action="<?= $action_url ?>" method="post">
<section>
<div class="cssload-loader" hidden="hidden">
<div class="cssload-inner cssload-one"></div>
<div class="cssload-inner cssload-two"></div>
<div class="cssload-inner cssload-three"></div>
</div>
<label for="search">Search for anime by name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="search" id="search" name="search" /></label>
<section id="series_list" class="media-wrap">
</section>
@ -34,11 +39,5 @@
</table>
</form>
</main>
<template id="show_list">
<article class="media">
<div class="name"><label><input type="radio" name="id" value="{{:id}}" />&nbsp;<span>{{:title}}<br />{{:alternate_title}}</span></label></div>
<img src="{{:cover_image}}" alt="{{:title}}" />
</article>
</template>
<script src="<?= $urlGenerator->asset_url('js.php/g/anime_collection') ?>"></script>
<?php endif ?>

View File

@ -12,6 +12,7 @@
*/
namespace Aviat\AnimeClient\Controller;
use Aviat\Ion\Json;
use Aviat\Ion\Di\ContainerInterface;
use Aviat\AnimeClient\Controller;
use Aviat\AnimeClient\Config;
@ -194,9 +195,9 @@ class Manga extends Controller {
$post_data = $transformer->untransform($post_data);
$full_result = $this->model->update($post_data);
$result = $full_result['body'];
$result = Json::decode((string)$full_result['body']);
if (array_key_exists('manga', $result))
if ($full_result['statusCode'] == 200)
{
$m =& $result['manga'][0];
$title = ( ! empty($m['english_title']))

View File

@ -50,6 +50,14 @@ class Manga extends API {
*/
protected $base_url = "https://hummingbird.me/";
/**
* Make an authenticated manga API call
*
* @param string $type - the HTTP verb
* @param string $url
* @param string|null $json
* @return array
*/
protected function _manga_api_call($type, $url, $json = NULL)
{
$token = $this->container->get('auth')