Skip to content

Commit

Permalink
fix: user auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
VIPER-VLAD committed Oct 16, 2021
1 parent ba010b9 commit a57ab29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function login($userName, $password, $auth = true)
static::setAuthToken(static::getResponse()->data->authToken);
}

return User::createOutOfResponse(static::getResponse()->data->me);
return User::createOutOfResponse(static::getResponse()->data);
}

/**
Expand Down
13 changes: 13 additions & 0 deletions src/Users/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ class User extends Request
{
use Data;

public function setUserAuthToken($token){
$this->authToken = $token;
}

public static function createOutOfResponse($response)
{
$user = new self($response->me->_id);
$user->setUserAuthToken($response->authToken);

return $user->updateOutOfResponse($response->me);
}


/**
* Gets user listing
*
Expand Down

0 comments on commit a57ab29

Please sign in to comment.