Files
romm/frontend/src/services/api/setup.ts

35 lines
773 B
TypeScript

import api from "@/services/api";
import type { Platform } from "@/stores/platforms";
export type LibraryStructure = "struct_a" | "struct_b" | null;
export interface ExistingPlatform {
fs_slug: string;
rom_count: number;
}
export interface SetupLibraryInfo {
detected_structure: LibraryStructure;
existing_platforms: ExistingPlatform[];
supported_platforms: Platform[];
}
export interface CreatePlatformsResponse {
success: boolean;
created_count: number;
message: string;
}
export default {
async getLibraryInfo() {
return await api.get<SetupLibraryInfo>("/setup/library");
},
async createPlatforms(platformSlugs: string[]) {
return await api.post<CreatePlatformsResponse>(
"/setup/platforms",
platformSlugs,
);
},
};