Skip to content

Commit

Permalink
Merge branch 'release/v1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Schendel committed Aug 20, 2023
2 parents 8568f15 + 9f83149 commit eb099b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 7 additions & 1 deletion AppApi.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function getModuleInfo() {
return [
'title' => 'AppApi',
'summary' => 'Module to create a REST API with ProcessWire',
'version' => '1.3.1',
'version' => '1.3.2',
'author' => 'Sebastian Schendel',
'icon' => 'terminal',
'href' => 'https://modules.processwire.com/modules/app-api/',
Expand Down Expand Up @@ -848,6 +848,12 @@ public static function getAjaxOf($content) {
'title' => $content->title,
'value' => $content->value
];
} elseif ($content instanceof WireArray) {
foreach ($content as $item) {
$output[] = self::getAjaxOf($item);
}
} elseif ($content instanceof WireData) {
$output = $content->getArray();
}

return $output;
Expand Down
16 changes: 10 additions & 6 deletions classes/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ protected function ___createSingleJWTToken($args = []) {
return $jwt;
}

public function ___doCurrentUser($data) {
return [
'id' => wire('user')->id,
'name' => wire('user')->name,
'loggedIn' => wire('user')->isLoggedIn()
];
}

public function ___doLogin($data) {
$access = $this->getLogintype($data);
$loggedIn = false;
Expand Down Expand Up @@ -602,11 +610,7 @@ public static function access() {
return self::getInstance()->getAccessToken();
}

public static function currentUser() {
return [
'id' => wire('user')->id,
'name' => wire('user')->name,
'loggedIn' => wire('user')->isLoggedIn()
];
public static function currentUser($data) {
return self::getInstance()->doCurrentUser($data);
}
}

0 comments on commit eb099b3

Please sign in to comment.