Skip to content

Commit

Permalink
Remove usage of Value Factory and optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TomashKhamlai committed Sep 14, 2018
1 parent 21e719c commit ad388f6
Showing 1 changed file with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

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

use Magento\Integration\Api\CustomerTokenServiceInterface;
use Magento\Framework\Exception\AuthenticationException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
use Magento\Framework\Exception\AuthenticationException;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Integration\Api\CustomerTokenServiceInterface;

/**
* Customers Token resolver, used for GraphQL request processing.
Expand All @@ -26,21 +24,14 @@ class GenerateCustomerToken implements ResolverInterface
*/
private $customerTokenService;

/**
* @var ValueFactory
*/
private $valueFactory;

/**
* @param CustomerTokenServiceInterface $customerTokenService
* @param ValueFactory $valueFactory
*/
public function __construct(
CustomerTokenServiceInterface $customerTokenService,
ValueFactory $valueFactory
CustomerTokenServiceInterface $customerTokenService

) {
$this->customerTokenService = $customerTokenService;
$this->valueFactory = $valueFactory;
}

/**
Expand All @@ -55,7 +46,7 @@ public function resolve(
) {
try {
$token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']);
return !empty($token) ? ['token' => $token] : '';
return ['token' => $token];
} catch (AuthenticationException $e) {
throw new GraphQlAuthorizationException(
__($e->getMessage())
Expand Down

0 comments on commit ad388f6

Please sign in to comment.