mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 08:39:25 +08:00
parent
de42c316c0
commit
2553f4f0a3
@ -13,4 +13,9 @@ class Response
|
||||
{
|
||||
return json_decode($this->response->getBody());
|
||||
}
|
||||
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->response->getStatusCode();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php namespace Flarum\Forum\Actions;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Http\RouteNotFoundException;
|
||||
|
||||
class DiscussionAction extends ClientAction
|
||||
{
|
||||
@ -70,6 +71,13 @@ class DiscussionAction extends ClientAction
|
||||
$actor = app('flarum.actor');
|
||||
$action = 'Flarum\Api\Actions\Discussions\ShowAction';
|
||||
|
||||
return $this->apiClient->send($actor, $action, $params)->getBody();
|
||||
$response = $this->apiClient->send($actor, $action, $params);
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode === 404) {
|
||||
throw new RouteNotFoundException;
|
||||
}
|
||||
|
||||
return $response->getBody();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user