Skip to content
Snippets Groups Projects
Commit 7b0cb9e7 authored by Fatih20's avatar Fatih20
Browse files

Proper gym fetching.

parent 62846a47
No related merge requests found
// import axios from "axios";
// import config from "../config";
// import { header } from ".";
import axios from "axios";
import config from "../config";
import { header } from ".";
import { GymReturned } from "../validationSchema/gym";
export async function getGym(): Promise<GymReturned[]> {
// return (await axios.get(`${config.NODE_JS_API}/api/gym/`, header)).data;
const myPromise = new Promise<GymReturned[]>(function (myResolve) {
myResolve([
{
averageRating: 5,
cityId: 1,
cityName: "Bruh City",
description: "dfklcdmfklm",
id: 2,
monthlyPrice: 5000,
name: "Bruh",
pictureId: 1,
videoId: 1,
},
{
averageRating: 5,
cityId: 2,
cityName: "Bruh City",
description: "dfklcdmfklm",
id: 1,
monthlyPrice: 5000,
name: "Bruh2",
pictureId: 1,
videoId: 1,
},
]);
});
return myPromise;
return (await axios.get(`${config.NODE_JS_API}/api/gym/`, header)).data.gyms;
}
export async function getGymById({ id }: { id: number }): Promise<GymReturned> {
// return (await axios.get(`${config.NODE_JS_API}/api/gym/${id}/`, header)).data;
const myPromise = new Promise<GymReturned>(function (myResolve) {
myResolve({
averageRating: 5,
cityId: 1,
cityName: "Bruh City",
description: "dfklcdmfklm",
id: id,
monthlyPrice: 5000,
name: "Bruh",
pictureId: 1,
videoId: 1,
});
});
return myPromise;
return (await axios.get(`${config.NODE_JS_API}/api/gym/${id}/`, header)).data
.gym;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment