|
|
@@ -3,7 +3,9 @@ |
|
|
namespace App\Controller; |
|
|
namespace App\Controller; |
|
|
|
|
|
|
|
|
use ApiPlatform\Api\IriConverterInterface; |
|
|
use ApiPlatform\Api\IriConverterInterface; |
|
|
|
|
|
use App\Entity\User; |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
|
use Symfony\Component\Security\Http\Attribute\CurrentUser; |
|
|
use Symfony\Component\Security\Http\Attribute\CurrentUser; |
|
|
@@ -20,9 +22,17 @@ class SecurityController extends AbstractController |
|
|
], 401); |
|
|
], 401); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return new Response(null, 204, [ |
|
|
|
|
|
'Location' => $iriConverter->getIriFromResource($user), |
|
|
|
|
|
|
|
|
/** @var User $user */ |
|
|
|
|
|
return new JsonResponse([ |
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
'username' => $user->getFirstName() . '_' . $user->getLastName(), |
|
|
|
|
|
'firstName' => $user->getFirstName(), |
|
|
|
|
|
'lastName' => $user->getLastName() |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// return new Response(null, 204, [ |
|
|
|
|
|
// 'Location' => $iriConverter->getIriFromResource($user), |
|
|
|
|
|
// ]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#[Route('/logout', name: 'app_logout')] |
|
|
#[Route('/logout', name: 'app_logout')] |
|
|
|