) : (
- recommendedSongs.map(song => (
+ recommendedSongs.map((song) => (
{song.title}
diff --git a/frontend/src/utils/GetStations.js b/frontend/src/utils/GetStations.js
index 21d954e..886f5c0 100644
--- a/frontend/src/utils/GetStations.js
+++ b/frontend/src/utils/GetStations.js
@@ -4,17 +4,22 @@ import {
} from "../constants/ApiConstants";
export async function getStations() {
- fetch(RADIOSTATION_URL + LIST_RADIOSTATIONS_ENDPOINT, {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- },
- })
- .then((response) => response.json())
- .then((data) => {
- console.log("Station:", data);
- })
- .catch((error) => {
- console.error("Error creating station:", error);
- });
+ try {
+ const response = await fetch(
+ RADIOSTATION_URL + LIST_RADIOSTATIONS_ENDPOINT,
+ {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ }
+ );
+
+ const data = await response.json();
+ console.log("Station:", data.data);
+ return data.data;
+ } catch (error) {
+ console.error("Error fetching stations:", error);
+ return [];
+ }
}
diff --git a/frontend/src/utils/StationsCreate.js b/frontend/src/utils/StationsCreate.js
index 34ac305..7d5d31f 100644
--- a/frontend/src/utils/StationsCreate.js
+++ b/frontend/src/utils/StationsCreate.js
@@ -7,8 +7,8 @@ import {
export async function createStation(name, description) {
const body = {
- name: "My Awesome Station",
- description: "The best music station ever",
+ name: name,
+ description: description,
};
fetch(RADIOSTATION_URL + CREATE_RADIOSTATION_ENDPOINT, {