Upload files to "api"
This commit is contained in:
+11
-3
@@ -13,11 +13,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
$rawData = file_get_contents('php://input');
|
||||
$data = json_decode($rawData, true);
|
||||
|
||||
if (!isset($data['email']) || !isset($data['password'])) {
|
||||
if (!$data) {
|
||||
$data = $_POST;
|
||||
}
|
||||
|
||||
if (empty($data['email']) || empty($data['password'])) {
|
||||
http_response_code(400);
|
||||
die(json_encode(['error' => 'Email and password are required']));
|
||||
die(json_encode([
|
||||
'error' => 'Email and password are required',
|
||||
'debug' => ['raw' => $rawData, 'post' => $_POST]
|
||||
]));
|
||||
}
|
||||
|
||||
$result = loginUser($data['email'], $data['password']);
|
||||
|
||||
Reference in New Issue
Block a user