| @@ -377,19 +377,27 @@ | ||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Get Featured Item List |
| 381 | + * @param WP_REST_Request $request | |
| 381 | 382 | * @return mixed |
| 382 | 383 | */ |
| 383 | - public function featured_items(){ | |
| 384 | + public function featured_items(WP_REST_Request $request){ | |
| 384 | 385 | $defaults = Database::get_transient( 'featuredItems' ); |
| 385 | 386 | if( $defaults ) { |
| 386 | 387 | return $defaults; |
| 387 | 388 | } |
| 388 | 389 | |
| 390 | + $platform = $request->get_param( 'platform' ); | |
| 391 | + $funcArgs = [ | |
| 392 | + // 'page' => 1, | |
| 393 | + // 'per_page' => 10, | |
| 394 | + 'platform' => $platform, | |
| 395 | + ]; | |
| 389 | 396 | $response = $this->http()->query( |
| 390 | 397 | 'featuredItems', |
| 391 | - 'data{ id, name, slug, price, type, thumbnail }' | |
| 398 | + 'data{ id, name, slug, price, type, thumbnail }', | |
| 399 | + $funcArgs | |
| 392 | 400 | )->post(); |
| 393 | 401 | |
| 394 | 402 | if( ! is_wp_error( $response ) ) { |
| 395 | 403 | Database::set_transient( 'featuredItems', $response ); |