put: {
editSport: (id: number, editSportData: IGetAllSports) =>
fetch(`${BASE_URL}/sports/${id}`, {
method: "PUT",
body: JSON.stringify(editSportData),
}).then((response) => response.json() as Promise<unknown>),
editRegion: (id: number, editRegionData: IGetAllRegions) =>
fetch(`${BASE_URL}/regions/${id}`, {
method: "PUT",
body: JSON.stringify({ ...editRegionData, abpIds: [] }),
}).then((response) => response.json() as Promise<unknown>),
editLeague: (
regionId: number,
leagueId: number,
editLeagueData: IGetAllLeagues
) =>
fetch(`${BASE_URL}/regions/${regionId}/leagues/${leagueId}`, {
method: "PUT",
body: JSON.stringify(editLeagueData),
}).then((response) => response.json() as Promise<unknown>),
},
delete: {
deleteSport: (id: number) =>
fetch(`${BASE_URL}/sports/${id}`, { method: "DELETE" })
.then((response) => response.json() as Promise<ISportApi>)
.then((response) => response.data),
deleteRegion: (id: number) =>
fetch(`${BASE_URL}/regions/${id}`, { method: "DELETE" })
.then((response) => response.json() as Promise<IRegionApi>)
.then((response) => response.data),
deleteLeague: (regionId: number, leagueId: number) =>
fetch(`${BASE_URL}/regions/${regionId}/leagues/${leagueId}`, {
method: "DELETE",
})
.then((response) => response.json() as Promise<ILeagueApi>)
.then((response) => response.data),
},
};