1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 17:51:24 +02:00

Initial refactor of client actions, data preloading, SEO

An initial stab at flarum/core#126. Still WIP. Preliminary
implementation of flarum/core#128 and flarum/core#13.
This commit is contained in:
Toby Zerner
2015-07-07 15:29:21 +09:30
parent c7383601e2
commit 23eec806e6
27 changed files with 413 additions and 241 deletions

View File

@@ -33,6 +33,6 @@ class Client
$response = $action->handle(new Request($input, $actor));
return json_decode($response->getBody());
return new Response($response);
}
}

View File

@@ -0,0 +1,16 @@
<?php namespace Flarum\Api;
use Psr\Http\Message\ResponseInterface;
class Response
{
public function __construct(ResponseInterface $response)
{
$this->response = $response;
}
public function getBody()
{
return json_decode($this->response->getBody());
}
}

View File

@@ -1,5 +1,7 @@
<?php namespace Flarum\Api\Serializers;
use Flarum\Core;
class ForumSerializer extends Serializer
{
/**
@@ -21,7 +23,12 @@ class ForumSerializer extends Serializer
protected function getDefaultAttributes($forum)
{
return [
'title' => $forum->title
'title' => $forum->title,
'baseUrl' => Core::config('base_url'),
'apiUrl' => Core::config('api_url'),
'welcomeTitle' => Core::config('welcome_title'),
'welcomeMessage' => Core::config('welcome_message'),
'themePrimaryColor' => Core::config('theme_primary_color')
];
}
}