Updated short URL deletion so that it accepts the domain

This commit is contained in:
Alejandro Celaya
2020-02-01 18:06:50 +01:00
parent 5f00d8b732
commit 732bb06c62
6 changed files with 37 additions and 23 deletions

View File

@@ -8,6 +8,7 @@ use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
@@ -26,8 +27,8 @@ class DeleteShortUrlAction extends AbstractRestAction
public function handle(ServerRequestInterface $request): ResponseInterface
{
$shortCode = $request->getAttribute('shortCode', '');
$this->deleteShortUrlService->deleteByShortCode($shortCode);
$identifier = ShortUrlIdentifier::fromApiRequest($request);
$this->deleteShortUrlService->deleteByShortCode($identifier);
return new EmptyResponse();
}
}