Add deleteUser API endpoint
This commit is contained in:
parent
755784a870
commit
0bcd0f8483
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
if($_SERVER['REQUEST_METHOD'] == 'DELETE') {
|
||||
if(!isset($_REQUEST['token'])) {
|
||||
$data = [
|
||||
'error' => true,
|
||||
'message' => 'Не передано поле token',
|
||||
];
|
||||
}
|
||||
elseif(!User::delete($_REQUEST['token'])) {
|
||||
$data = [
|
||||
'error' => true,
|
||||
'message' => 'Невалидный токен',
|
||||
];
|
||||
}
|
||||
else {
|
||||
$data = [
|
||||
'error' => false,
|
||||
'message' => 'Пользователь удален',
|
||||
];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data = [
|
||||
'error' => true,
|
||||
'message' => 'Только DELETE метод',
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue