Skip to content

Commit

Permalink
Simplify code to avoid complexity of getting just one string
Browse files Browse the repository at this point in the history
  • Loading branch information
TomashKhamlai committed Sep 14, 2018
1 parent 6a250c1 commit 21e719c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,10 @@ public function resolve(
ResolveInfo $info,
array $value = null,
array $args = null
): Value {
) {
try {
$token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']);
$result = function () use ($token) {
return !empty($token) ? ['token' => $token] : '';
};
return $this->valueFactory->create($result);
return !empty($token) ? ['token' => $token] : '';
} catch (AuthenticationException $e) {
throw new GraphQlAuthorizationException(
__($e->getMessage())
Expand Down

0 comments on commit 21e719c

Please sign in to comment.