Add getUser API endpoint

This commit is contained in:
BitHeaven 2024-08-09 21:45:57 +05:00
parent e2d3fc3cee
commit b844041ea9
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<?php
if(!isset($_GET['login'])) {
$data = [
'error' => true,
'message' => 'Не передано поле login',
];
}
elseif(!$user = User::get($_GET['login'])) {
$data = [
'error' => true,
'message' => 'Пользователь не существует',
];
}
else {
$data = [
'error' => false,
'data' => $user,
];
}