mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import type { MessageResponse, PlatformSchema } from "@/__generated__";
|
|
import api from "@/services/api/index";
|
|
|
|
export const platformApi = api;
|
|
|
|
async function uploadPlatform({
|
|
fsSlug,
|
|
}: {
|
|
fsSlug: string;
|
|
}): Promise<{ data: MessageResponse[] }> {
|
|
return api.post("/platforms", { fs_slug: fsSlug });
|
|
}
|
|
|
|
async function getPlatforms(): Promise<{ data: PlatformSchema[] }> {
|
|
return api.get("/platforms");
|
|
}
|
|
|
|
async function getPlatform(
|
|
id: number | undefined
|
|
): Promise<{ data: PlatformSchema }> {
|
|
return api.get(`/platforms/${id}`);
|
|
}
|
|
|
|
async function getSupportedPlatforms(): Promise<{ data: PlatformSchema[] }> {
|
|
return api.get("/platforms/supported");
|
|
}
|
|
|
|
async function updatePlatform({
|
|
platform,
|
|
}: {
|
|
platform: PlatformSchema;
|
|
}): Promise<{ data: MessageResponse }> {
|
|
return api.delete(`/platforms/${platform.id}`);
|
|
}
|
|
|
|
async function deletePlatform({
|
|
platform,
|
|
}: {
|
|
platform: PlatformSchema;
|
|
}): Promise<{ data: MessageResponse }> {
|
|
return api.delete(`/platforms/${platform.id}`);
|
|
}
|
|
|
|
export default {
|
|
uploadPlatform,
|
|
getPlatforms,
|
|
getPlatform,
|
|
getSupportedPlatforms,
|
|
deletePlatform,
|
|
};
|