Reformatted stuff.
This commit is contained in:
parent
d96d5bbe63
commit
7090036736
|
@ -1,49 +1,54 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: 'http://localhost:8080'
|
baseURL: 'http://localhost:8080',
|
||||||
});
|
});
|
||||||
|
|
||||||
export interface GymIdentifiable {
|
export interface GymIdentifiable {
|
||||||
countryCode: string,
|
countryCode: string;
|
||||||
cityShortName: string,
|
cityShortName: string;
|
||||||
shortName: string
|
shortName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Gym = {
|
export type Gym = {
|
||||||
countryCode: string,
|
countryCode: string;
|
||||||
countryName: string,
|
countryName: string;
|
||||||
cityShortName: string,
|
cityShortName: string;
|
||||||
cityName: string,
|
cityName: string;
|
||||||
createdAt: Date,
|
createdAt: Date;
|
||||||
shortName: string,
|
shortName: string;
|
||||||
displayName: string,
|
displayName: string;
|
||||||
websiteUrl: string | null,
|
websiteUrl: string | null;
|
||||||
location: {
|
location: {
|
||||||
latitude: number,
|
latitude: number;
|
||||||
longitude: number
|
longitude: number;
|
||||||
},
|
};
|
||||||
streetAddress: string
|
streetAddress: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getGym(countryCode: string, cityShortName: string, gymShortName: string): Promise<Gym> {
|
export async function getGym(
|
||||||
const response = await api.get(`/gyms/${countryCode}/${cityShortName}/${gymShortName}`);
|
countryCode: string,
|
||||||
const d = response.data;
|
cityShortName: string,
|
||||||
const gym: Gym = {
|
gymShortName: string
|
||||||
countryCode: d.countryCode,
|
): Promise<Gym> {
|
||||||
countryName: d.countryName,
|
const response = await api.get(
|
||||||
cityShortName: d.cityShortName,
|
`/gyms/${countryCode}/${cityShortName}/${gymShortName}`
|
||||||
cityName: d.cityName,
|
);
|
||||||
createdAt: new Date(d.createdAt),
|
const d = response.data;
|
||||||
shortName: d.shortName,
|
return {
|
||||||
displayName: d.displayName,
|
countryCode: d.countryCode,
|
||||||
websiteUrl: d.websiteUrl,
|
countryName: d.countryName,
|
||||||
location: d.location,
|
cityShortName: d.cityShortName,
|
||||||
streetAddress: d.streetAddress
|
cityName: d.cityName,
|
||||||
};
|
createdAt: new Date(d.createdAt),
|
||||||
return gym;
|
shortName: d.shortName,
|
||||||
|
displayName: d.displayName,
|
||||||
|
websiteUrl: d.websiteUrl,
|
||||||
|
location: d.location,
|
||||||
|
streetAddress: d.streetAddress,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getGymRoute(gym: GymIdentifiable): string {
|
export function getGymRoute(gym: GymIdentifiable): string {
|
||||||
return `/g/${gym.countryCode}/${gym.cityShortName}/${gym.shortName}`
|
return `/g/${gym.countryCode}/${gym.cityShortName}/${gym.shortName}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* Module for interacting with the Gymboard search service's API.
|
||||||
|
*/
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
|
|
Loading…
Reference in New Issue