28 lines
543 B
PHP
28 lines
543 B
PHP
<?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 метод',
|
||
];
|
||
}
|