You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
586 B

import * as serverApi from '../../api/api';
import { GetArtistResponse } from '../../api/api';
import backendRequest from './request';
export async function getArtist(id: number): Promise<GetArtistResponse> {
if (isNaN(id)) {
throw new Error("Cannot request a NaN artist.");
}
const response = await backendRequest((process.env.REACT_APP_BACKEND || "") + serverApi.GetArtistEndpoint.replace(':id', `${id}`))
if (!response.ok) {
throw new Error("Response to artist request not OK: " + JSON.stringify(response));
}
return await response.json();
}