Added view proxies
This commit is contained in:
parent
18d9c21435
commit
2335037a9c
3 changed files with 34 additions and 2 deletions
|
@ -28,8 +28,8 @@ final class AuthController extends AbstractController
|
|||
throw new \Szurubooru\MissingArgumentException();
|
||||
|
||||
return [
|
||||
'token' => $this->authService->getLoginToken(),
|
||||
'user' => $this->authService->getLoggedInUser()
|
||||
'token' => new \Szurubooru\ViewProxies\Token($this->authService->getLoginToken()),
|
||||
'user' => new \Szurubooru\ViewProxies\User($this->authService->getLoggedInUser()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
17
src/ViewProxies/Token.php
Normal file
17
src/ViewProxies/Token.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
namespace Szurubooru\ViewProxies;
|
||||
|
||||
class Token
|
||||
{
|
||||
public $name;
|
||||
public $purpose;
|
||||
|
||||
public function __construct($token)
|
||||
{
|
||||
if (!$token)
|
||||
return;
|
||||
|
||||
$this->name = $token->name;
|
||||
$this->purpose = $token->purpose;
|
||||
}
|
||||
}
|
15
src/ViewProxies/User.php
Normal file
15
src/ViewProxies/User.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
namespace Szurubooru\ViewProxies;
|
||||
|
||||
class User
|
||||
{
|
||||
public $name;
|
||||
|
||||
public function __construct($user)
|
||||
{
|
||||
if (!$user)
|
||||
return;
|
||||
|
||||
$this->name = $user->name;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue