Skip to content

Commit ad388f6

Browse files
committed
Remove usage of Value Factory and optimize imports
1 parent 21e719c commit ad388f6

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
namespace Magento\CustomerGraphQl\Model\Resolver\Customer\Account;
99

10-
use Magento\Integration\Api\CustomerTokenServiceInterface;
10+
use Magento\Framework\Exception\AuthenticationException;
1111
use Magento\Framework\GraphQl\Config\Element\Field;
1212
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
13-
use Magento\Framework\Exception\AuthenticationException;
14-
use Magento\Framework\GraphQl\Query\Resolver\Value;
15-
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
1613
use Magento\Framework\GraphQl\Query\ResolverInterface;
1714
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Integration\Api\CustomerTokenServiceInterface;
1816

1917
/**
2018
* Customers Token resolver, used for GraphQL request processing.
@@ -26,21 +24,14 @@ class GenerateCustomerToken implements ResolverInterface
2624
*/
2725
private $customerTokenService;
2826

29-
/**
30-
* @var ValueFactory
31-
*/
32-
private $valueFactory;
33-
3427
/**
3528
* @param CustomerTokenServiceInterface $customerTokenService
36-
* @param ValueFactory $valueFactory
3729
*/
3830
public function __construct(
39-
CustomerTokenServiceInterface $customerTokenService,
40-
ValueFactory $valueFactory
31+
CustomerTokenServiceInterface $customerTokenService
32+
4133
) {
4234
$this->customerTokenService = $customerTokenService;
43-
$this->valueFactory = $valueFactory;
4435
}
4536

4637
/**
@@ -55,7 +46,7 @@ public function resolve(
5546
) {
5647
try {
5748
$token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']);
58-
return !empty($token) ? ['token' => $token] : '';
49+
return ['token' => $token];
5950
} catch (AuthenticationException $e) {
6051
throw new GraphQlAuthorizationException(
6152
__($e->getMessage())

0 commit comments

Comments
 (0)