Added http response code
This commit is contained in:
@@ -14,17 +14,15 @@ if(isset($_POST['1Vote'])){
|
||||
$vote->points += 1;
|
||||
if(!empty($_POST['comment'])){
|
||||
$vote->comment = $_POST['comment'];
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=EmptyField");
|
||||
exit();
|
||||
}
|
||||
$vote->save();
|
||||
header("location: ../../../Frontend/index.html?success=YouHaveVoted");
|
||||
exit();
|
||||
if(!$vote->save()){
|
||||
http_response_code(500);
|
||||
}else{
|
||||
http_response_code(201);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=YouCantVoted");
|
||||
exit();
|
||||
http_response_code(400);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,4 +7,6 @@ if(isLogin()){
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo Vote::where('group_id',groupViaToken($_SESSION['token'])->id)->get()->toJson(JSON_PRETTY_PRINT);
|
||||
|
||||
}else{
|
||||
http_response_code(401);
|
||||
}
|
||||
|
||||
@@ -28,5 +28,7 @@ if(isAdmin() && isset($_GET['gameJamId'])){
|
||||
echo $winningGroups->toJson(JSON_PRETTY_PRINT);
|
||||
|
||||
|
||||
}else{
|
||||
http_response_code(401);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user