Fix manga list updating

This commit is contained in:
Timothy Warren 2015-11-16 15:57:37 -05:00
parent c009a96a15
commit 4ed6200d9f
3 changed files with 21 additions and 3 deletions

View File

@ -35,7 +35,7 @@
dataType: 'json', dataType: 'json',
method: 'POST', method: 'POST',
mimeType: 'application/json', mimeType: 'application/json',
url: BASE_URL + '/' + CONTROLLER + '/update' url: BASE_URL + CONTROLLER + '/update'
}).done(function(res) { }).done(function(res) {
console.table(res); console.table(res);
parent_sel.find("."+type+"s_read").text(completed); parent_sel.find("."+type+"s_read").text(completed);

View File

@ -52,6 +52,7 @@ class MenuGenerator extends UrlGenerator {
/** /**
* Generate the full menu structure from the config files * Generate the full menu structure from the config files
* *
* @param array $menus
* @return array * @return array
*/ */
protected function parse_config(array $menus) protected function parse_config(array $menus)

View File

@ -16,6 +16,9 @@ use Aviat\AnimeClient\Model\API;
use Aviat\AnimeClient\Hummingbird\Transformer; use Aviat\AnimeClient\Hummingbird\Transformer;
use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus; use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus;
use GuzzleHttp\Cookie\Cookiejar;
use GuzzleHttp\Cookie\SetCookie;
/** /**
* Model for handling requests dealing with the manga list * Model for handling requests dealing with the manga list
*/ */
@ -56,9 +59,23 @@ class Manga extends API {
$id = $data['id']; $id = $data['id'];
unset($data['id']); unset($data['id']);
// @TODO update with auth key from auth class $token = $this->container->get('auth')
->get_auth_token();
$domain = $this->container->get('request')
->server->get('HTTP_HOST');
// Set the token cookie, with the authentication token
// from the auth class.
$cookieJar = $this->cookieJar;
$cookie_data = new SetCookie([
'Name' => 'token',
'Value' => $token,
'Domain' => 'hummingbird.me'
]);
$cookieJar->setCookie($cookie_data);
$result = $this->put("manga_library_entries/{$id}", [ $result = $this->put("manga_library_entries/{$id}", [
'cookies' => ['token' => ''], 'cookies' => $cookieJar,
'json' => ['manga_library_entry' => $data] 'json' => ['manga_library_entry' => $data]
]); ]);