Browser-cache localization strings (+ new API endpoint to get them)

This commit is contained in:
Bernd Bestel
2021-06-29 20:24:02 +02:00
parent d18a8d8b56
commit b856911f0f
8 changed files with 52 additions and 10 deletions

View File

@@ -17,8 +17,13 @@ class BaseApiController extends BaseController
parent::__construct($container);
}
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data)
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data, $cache = false)
{
if ($cache)
{
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
}
$response->getBody()->write(json_encode($data));
return $response;
}