-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from malekch-15/back2dto
Back2dto
- Loading branch information
Showing
12 changed files
with
50 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package reacp.model; | ||
|
||
public record RestaurantModelDto( | ||
String name, | ||
String city, | ||
String category, | ||
String description, | ||
WishlistStatus status | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
|
||
export default function Details(){ | ||
|
||
return ( | ||
<> | ||
<h2>Details</h2> | ||
<p>Details of the restaurant</p> | ||
</> | ||
); | ||
} | ||
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +0,0 @@ | ||
import {Restaurant} from "./Restaurant.ts"; | ||
import axios from "axios"; | ||
import {useEffect, useState} from "react"; | ||
import {WishlistStatus} from "./WishlistStatus.ts"; | ||
|
||
type Props = { | ||
restaurant: Restaurant; | ||
onAddToWishlist: (id: string) => void; | ||
onRemoveFromWishlist: (id: string) => void; | ||
wishlistStatus: WishlistStatus; | ||
onRestaurantUpdate: (restaurant: Restaurant) => void; | ||
} | ||
|
||
export default function RestaurantCard() { | ||
|
||
const [restaurants, setRestaurants] = useState<Restaurant[]>([]); | ||
|
||
function fetchRestaurants() { | ||
axios.get("api/restaurant") | ||
.then((response) => { | ||
setRestaurants(response.data); | ||
}) | ||
.catch((error) => console.error("Error fetching restaurants:", error)); | ||
} | ||
|
||
useEffect(fetchRestaurants, []); | ||
|
||
if(!restaurants) { | ||
return "Loading..."; | ||
} | ||
|
||
|
||
return ( | ||
<> | ||
<div className={"page"}> | ||
<h1>Restaurants</h1> | ||
<div className={"restaurant-list"}> | ||
{restaurants.map((restaurant) => ( | ||
<div key={restaurant.id} className={"restaurant-card"}> | ||
<h2>{restaurant.name}</h2> | ||
<p>{restaurant.city}</p> | ||
<p>{restaurant.category}</p> | ||
<p>{restaurant.description}</p> | ||
</div> | ||
))} | ||
</div> | ||
|
||
</div> | ||
</> | ||
); | ||
} | ||
Empty file.
File renamed without changes.
File renamed without changes.