Changing some single response JSON structures (old structures still included)

This commit is contained in:
Timo Ley 2020-09-30 22:03:52 +02:00
parent 4d8223d01c
commit 1b52881fb5
1 changed files with 20 additions and 0 deletions

View File

@ -61,9 +61,16 @@ if ($method == "GET") {
$obj->status = 200;
$path = $row["path"];
$path = str_replace(" ", "%20", $path);
$obj->link = $jmurl . $path;
$obj->user = $row["user"];
$obj->category = $row["cat"];
$meme = new stdClass();
$meme->link = $jmurl . $path;
$meme->user = $row["user"];
$meme->category = $row["cat"];
$obj->meme = $meme;
}
}
break;
@ -80,9 +87,16 @@ if ($method == "GET") {
$meme = $memes[$random];
if (isset($meme->path)) {
$obj->status = 200;
$obj->link = $jmurl . $meme->path;
$obj->category = $meme->category;
$obj->user = $meme->user;
$img = new stdClass();
$img->link = $jmurl . $meme->path;
$img->category = $meme->category;
$img->user = $meme->user;
$obj->meme = $img;
}
break;
case "/categories":
@ -97,8 +111,14 @@ if ($method == "GET") {
$row = mysqli_fetch_array($res, MYSQLI_ASSOC);
if ($row) {
$obj->status = 200;
$obj->id = $row["id"];
$obj->name = $row["name"];
$cat = new stdClass();
$cat->id = $row["id"];
$cat->name = $row["name"];
$obj->category = $cat;
}
}
break;