Fixed /video

This commit is contained in:
Pablo Ferreiro 2022-03-11 23:39:56 +01:00
parent 7b5ec2211e
commit 9c95620384
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
2 changed files with 5 additions and 19 deletions

View file

@ -3,17 +3,17 @@ namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Models\ItemTemplate;
use App\Models\FeedTemplate;
class VideoController {
static public function get(string $video_id) {
$api = Misc::api();
$item = $api->getVideoByID($video_id);
if ($item->meta->success) {
$feed = $api->getVideoByID($video_id);
if ($feed->meta->success) {
$latte = Misc::latte();
$latte->render(Misc::getView('video'), new ItemTemplate($item->info->detail->nickname, $item));
$latte->render(Misc::getView('video'), new FeedTemplate('Video', $feed));
} else {
ErrorHandler::show($item->meta);
ErrorHandler::show($feed->meta);
}
}
}

View file

@ -1,14 +0,0 @@
<?php
namespace App\Models;
/**
* Base for templates with item (only /video at the time)
*/
class ItemTemplate extends BaseTemplate {
public object $item;
function __construct(string $title, object $item) {
parent::__construct($title);
$this->item = $item;
}
}