Skip to content

Commit

Permalink
cambio para url de desplegado de servicio a consumir
Browse files Browse the repository at this point in the history
  • Loading branch information
Rendxnn committed Nov 20, 2024
1 parent fdddaae commit fd5b0db
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions app/Http/Controllers/Service/PartnersStoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,17 @@
class PartnersStoreController extends Controller
{
// Por ejemplo así (leer lo de abajo primero)
protected static $partnersServiceUri = 'http://partners-store.online:8000/api/products';
protected static $partnersServiceUri = 'http://34.31.28.251/public/api/products';

public function index(): View
{
// No creo que sea buena idea ponerlo en el .env
// tocaría mover varias cosas del dockerfile y el workflow de creación de la imagen.
// Hasta toca ponerla como secreto en el repo. Mejor quémalo! (línea 14) - Esteban
$baseUrl = env('PARTNERS_SERVICE_URI');

//$response = Http::get($baseUrl . 'api/products');
//$products = $responseFake->json()['data'];

$responseFake = '{
"data": [
{
"id": 1,
"name": "Airpods",
"description": "Pro",
"price": 400,
"warranty": 4,
"image_url": "https://cdn.revendo.com/media/50/61/03/1697580367/apple-airpods-pro-2-generation-weiss-guenstig-gebraucht-kaufen-00.png.png"
},
{
"id": 2,
"name": "Sony Noise Cancelling Headphones",
"description": "WH-1000XM4",
"price": 350,
"warranty": 1,
"image_url": "https://media.wired.com/photos/5f2b2e792f0075bf6e0a1de6/master/pass/Gear-Sony-WH-1000XM4-1-SOURCE-Sony.jpg"
}
]
}';
$decodedFakeResponse = json_decode($responseFake, true);

$products = $decodedFakeResponse['data'];

$response = Http::get(self::$partnersServiceUri);
$products = $response->json()['data'];

$viewData = [];
$viewData['products'] = $products;

//dd($viewData);

return view('partners-products.index')->with('viewData', $viewData);

}
Expand Down

0 comments on commit fd5b0db

Please sign in to comment.