Replace number input with dropdown on "Add a product"
This commit is contained in:
parent
bbadf90874
commit
d20fcfaadb
6 changed files with 173 additions and 14 deletions
39
includes/api/wishlists.php
Normal file
39
includes/api/wishlists.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* wishlists.php
|
||||
*
|
||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
||||
use wishthis\User;
|
||||
|
||||
$api = true;
|
||||
$response = array(
|
||||
'success' => false,
|
||||
);
|
||||
|
||||
require '../../index.php';
|
||||
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'GET':
|
||||
if (isset($_GET['userid'])) {
|
||||
$user = new User($_GET['userid']);
|
||||
$wishlists = $user->getWishlists();
|
||||
$wishlists = array_map(function ($wishlist) {
|
||||
return array(
|
||||
'name' => $wishlist['name'],
|
||||
'value' => $wishlist['id'],
|
||||
'text' => $wishlist['name'],
|
||||
);
|
||||
}, $wishlists);
|
||||
|
||||
$response['results'] = $wishlists;
|
||||
$response['success'] = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
die();
|
Loading…
Add table
Add a link
Reference in a new issue