10
10
use Magento \Authorization \Model \UserContextInterface ;
11
11
use Magento \Framework \GraphQl \Config \Element \Field ;
12
12
use Magento \Framework \GraphQl \Exception \GraphQlAuthorizationException ;
13
- use Magento \Framework \GraphQl \Query \Resolver \Value ;
14
- use Magento \Framework \GraphQl \Query \Resolver \ValueFactory ;
15
13
use Magento \Framework \GraphQl \Query \ResolverInterface ;
16
14
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
17
15
use Magento \Integration \Api \CustomerTokenServiceInterface ;
@@ -31,24 +29,16 @@ class RevokeCustomerToken implements ResolverInterface
31
29
*/
32
30
private $ customerTokenService ;
33
31
34
- /**
35
- * @var ValueFactory
36
- */
37
- private $ valueFactory ;
38
-
39
32
/**
40
33
* @param UserContextInterface $userContext
41
34
* @param CustomerTokenServiceInterface $customerTokenService
42
- * @param ValueFactory $valueFactory
43
35
*/
44
36
public function __construct (
45
37
UserContextInterface $ userContext ,
46
- CustomerTokenServiceInterface $ customerTokenService ,
47
- ValueFactory $ valueFactory
38
+ CustomerTokenServiceInterface $ customerTokenService
48
39
) {
49
40
$ this ->userContext = $ userContext ;
50
41
$ this ->customerTokenService = $ customerTokenService ;
51
- $ this ->valueFactory = $ valueFactory ;
52
42
}
53
43
54
44
/**
@@ -60,9 +50,8 @@ public function resolve(
60
50
ResolveInfo $ info ,
61
51
array $ value = null ,
62
52
array $ args = null
63
- ): Value {
64
-
65
- $ customerId = (int ) $ this ->userContext ->getUserId ();
53
+ ) {
54
+ $ customerId = (int )$ this ->userContext ->getUserId ();
66
55
67
56
if ($ customerId === 0 ) {
68
57
throw new GraphQlAuthorizationException (
@@ -73,10 +62,6 @@ public function resolve(
73
62
);
74
63
}
75
64
76
- $ result = function () use ($ customerId ) {
77
- return $ this ->customerTokenService ->revokeCustomerAccessToken ($ customerId );
78
- };
79
-
80
- return $ this ->valueFactory ->create ($ result );
65
+ return $ this ->customerTokenService ->revokeCustomerAccessToken ($ customerId );
81
66
}
82
67
}
0 commit comments