7
7
8
8
namespace Magento \CustomerGraphQl \Model \Resolver \Customer \Account ;
9
9
10
- use Magento \Integration \ Api \ CustomerTokenServiceInterface ;
10
+ use Magento \Framework \ Exception \ AuthenticationException ;
11
11
use Magento \Framework \GraphQl \Config \Element \Field ;
12
12
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 ;
16
13
use Magento \Framework \GraphQl \Query \ResolverInterface ;
17
14
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
15
+ use Magento \Integration \Api \CustomerTokenServiceInterface ;
18
16
19
17
/**
20
18
* Customers Token resolver, used for GraphQL request processing.
@@ -26,21 +24,14 @@ class GenerateCustomerToken implements ResolverInterface
26
24
*/
27
25
private $ customerTokenService ;
28
26
29
- /**
30
- * @var ValueFactory
31
- */
32
- private $ valueFactory ;
33
-
34
27
/**
35
28
* @param CustomerTokenServiceInterface $customerTokenService
36
- * @param ValueFactory $valueFactory
37
29
*/
38
30
public function __construct (
39
- CustomerTokenServiceInterface $ customerTokenService,
40
- ValueFactory $ valueFactory
31
+ CustomerTokenServiceInterface $ customerTokenService
32
+
41
33
) {
42
34
$ this ->customerTokenService = $ customerTokenService ;
43
- $ this ->valueFactory = $ valueFactory ;
44
35
}
45
36
46
37
/**
@@ -55,7 +46,7 @@ public function resolve(
55
46
) {
56
47
try {
57
48
$ token = $ this ->customerTokenService ->createCustomerAccessToken ($ args ['email ' ], $ args ['password ' ]);
58
- return ! empty ( $ token ) ? ['token ' => $ token ] : '' ;
49
+ return ['token ' => $ token ];
59
50
} catch (AuthenticationException $ e ) {
60
51
throw new GraphQlAuthorizationException (
61
52
__ ($ e ->getMessage ())
0 commit comments