diff --git a/frontend/src/services/api.js b/frontend/src/services/api.js index c669f3b65..2a6bac24e 100644 --- a/frontend/src/services/api.js +++ b/frontend/src/services/api.js @@ -1,6 +1,26 @@ import axios from 'axios' -export async function fetchPlatforms () { +export async function fetchPlatformsApi () { return axios.get('/api/platforms') } + +export async function fetchRomsApi (platform) { + return axios.get(`/api/platforms/${platform}/roms`) +} + +export async function fetchRomApi (platform, rom) { + return axios.get(`/api/platforms/${platform}/roms/${rom}`) +} + +export async function updateRomApi (rom, updatedRom) { + return axios.patch(`/api/platforms/${rom.p_slug}/roms/${rom.id}`, { updatedRom: updatedRom }) +} + +export async function deleteRomApi (rom, deleteFromFs) { + return axios.delete(`/api/platforms/${rom.p_slug}/roms/${rom.id}?filesystem=${deleteFromFs}`) +} + +export async function searchRomApi (searchTerm, searchBy, rom) { + return axios.put(`/api/search/roms/igdb?search_term=${searchTerm}&search_by=${searchBy}`, { rom: rom }) +}